P25485 [AtCoder] [ABC022B] Bumble Bee
普及-
题目描述

Problem Description

Takahashi is a bumblebee, a type of honeybee.

Today, he visited $ N $ different flowers in search of nectar.

The type of the $ i $-th flower he visited is $ A_i $.

The $ i $-th flower will be pollinated if there exists a $ j $ such that $ i > j $ and the type of the $ i $-th flower is the same as the type of the $ j $-th flower.

Given the information about the types of the $ N $ flowers Takahashi visited, find out how many of these flowers were pollinated.

Note that you do not need to consider pollination by other bees or self-pollination.

Input Format

The input is given from the standard input in the following format:

$ N $ $ A_1 $ $ A_2 $ : $ A_N $

  • The first line contains an integer $N(1 \leq N \leq 10^5)$, representing the number of flowers Takahashi visited.
  • The next $ N $ lines contain an integer $A_i (1 \leq A_i \leq 10^5)$, representing the type of the $ i $-th flower Takahashi visited.

Output Format

Output the number of flowers that were pollinated in one line. Make sure to include a newline at the end of the output.

Sample Input and Output

Sample Input #1

5
1
2
3
2
1

Sample Output #1

2

Sample Input #2

11
3
1
4
1
5
9
2
6
5
3
5

Sample Output #2

4

Notes/Hints

Sample Explanation 1

The 4th and 5th flowers will be pollinated.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 1 2 3 2 1
样例输出
2