Count Uncommon ElementsMedium

Count Uncommon Elements

MediumPractice library · +20 XPhash mapcounting

Given a list of N integers, determine the count of integers that appear exactly once in the list.

Input

The first line contains an integer N (the number of elements). The second line contains N space-separated integers.

Output

Print a single integer: the count of elements that appear exactly once.

Constraints

1 <= N <= 200000; -10^9 <= integer value <= 10^9

Time limit 1 s (native code; slower languages get more)Memory 256 MB14 hidden tests

Example 1

Input
5
1 2 2 3 1
Output
1

Numbers 1 and 2 appear twice, number 3 appears once. Output is 1.

Example 2

Input
7
5 5 5 5 5 5 5
Output
0

The number 5 appears 7 times. No element appears exactly once. Output is 0.

Hints