#C7327. Socks Pairing: Minimum Socks to Add
Socks Pairing: Minimum Socks to Add
Socks Pairing: Minimum Socks to Add
You are given a collection of socks, where each sock is represented by an integer denoting its color. Your task is to determine the minimum number of socks that must be added so that every sock in the collection has a matching pair.
Formally, for each color, if the count of socks is odd, then one additional sock of that color is required to complete a pair. The answer is the total number of such extra socks needed.
Input Format: The first line contains a single integer \(n\) denoting the number of socks. The second line contains \(n\) space-separated integers representing the colors of the socks.
Output Format: Output a single integer --- the minimum number of socks that need to be added.
inputFormat
The first line of the input contains an integer \(n\) denoting the number of socks. The second line contains \(n\) space separated integers where each integer represents the color of a sock.
outputFormat
Output a single integer representing the minimum number of additional socks required so that every sock can be paired with another sock of the same color.
## sample5
1 2 1 2 3
1