E - 1つだけ
解説
/
/
実行時間制限: 2 sec / メモリ制限: 1024 MiB
問題文
長さ N の整数列 A=(A_1,A_2,\ldots,A_N) が与えられます。
A の中にちょうど 1 つ含まれる整数が何種類あるか求めてください。
制約
- 1\le N\le 5\times 10^5
- 1\le A_i\le 10^9
- 入力される値は全て整数
入力
入力は以下の形式で標準入力から与えられる。
N A_1 A_2 \ldots A_N
出力
答えを出力せよ。
入力例 1
5 4 1 4 2 3
出力例 1
3
A にちょうど 1 つ含まれる整数は 1,2,3 の 3 つです。したがって、 3 を出力してください。
入力例 2
3 4 4 4
出力例 2
0
入力例 3
8 6 6 1 4 8 6 4 3
出力例 3
3
Problem Statement
You are given an integer sequence A=(A_1,A_2,\ldots,A_N) of length N.
How many distinct integers occur exactly once in A?
Constraints
- 1\le N\le 5\times 10^5
- 1\le A_i\le 10^9
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N A_1 A_2 \ldots A_N
Output
Print the answer.
Sample Input 1
5 4 1 4 2 3
Sample Output 1
3
Three integers, 1, 2, and 3, occur exactly once in A. Thus, print 3.
Sample Input 2
3 4 4 4
Sample Output 2
0
Sample Input 3
8 6 6 1 4 8 6 4 3
Sample Output 3
3