CiscoOA #6
Count Days with Odd Number of Birthdays
Estimated EasyJudge-ready
Topics (AI-labelled)Hashing
Given the integer date identifier of each birthday celebration, count the distinct identifiers that occur an odd number of times. The answer is a count, not a particular date value that occurs an odd number of times; there may be several dates with odd counts.
Input
The first line contains N, and the second line contains N integers. The original gave no bounds on the count or the date values; this site uses 0≤N≤200000 and identifiers in −10^9..10^9, treated as abstract date labels and not further restricted to 1..31 because of the birthday story.
Output
Output a single integer, the answer.
Example 1
Input:
5
4 8 2 8 9
Output:
3
Example 2
Input:
8
3 3 3 7 7 7 7 7
Output:
2
Example 3
Input:
0
Output:
0
Example notes
The outputs of the three public examples are, in order: 3; 2; 0. Verified by independent enumeration or direct simulation.
Editorial
Loading solution…