G. Fried Avocado
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

In Universe 1120, the Torchy's mafia is going after the popular chain Babo Cob's for sniping their business with the UTPC competitions. However, they have too much internal rivalry, thereby making resistance futile. The leader of the chain of Babo Cob's wants to figure out what the best case scenario is - what's the maximum number of people in the Torchy's mafia who die from this rivalry.

The Torchy's mafia has $$$n$$$ members, numbered $$$1, 2, ... n$$$. They all have a single rival who they want to target — member $$$i$$$ wants to shoot down member $$$s_i$$$. Note that it is possible for $$$i = s_i$$$ (the nerves ... ). They shoot in a predetermined order, one after the other. The leader of Babo Cob's has a mole in the Torchy's mafia who can influence the order, and wants to know the maximum number of people who can die, given that they are ordered optimally.

Input

The first line of input contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of members.

The second line contains $$$n$$$ space separated integers $$$s_1, s_2, ... s_n$$$ ($$$1 \le s_i \le n$$$) — the member who the $$$i$$$th member wants to shoot down, respectively.

Output

A single integer that gives the maximum number of casualties across all permutations of members.

Example
Input
8
2 3 2 2 6 7 8 5
Output
5
Note

In the first sample, we can achieve 5 deaths (and no better) from the order - 2 1 3 4 5 8 7 6. Members 2, 3, 5, 6 and 8 die from this sequence.