XI Olympiad in Informatics 2003/2004

Task: szp

Spies

I stage competition  
Source file: szp.xxx (xxx=pas,c,cpp)
Memory limit: 32 MB

Byteotian Intelligence Agency (BIA) employs many spies. Each of them has duty to shadow exactly one other spy.

King Byteasar wants to entrust as many agents as possible with a top secret operation. However, the operation is so important that each spy taking part has to be traced by at least one agent not involved in the operation (assignment of shadowing BIA spies does not change).

Task

Write a programme that:

Input

In the first line of the input there is one positive integer written, n - the number of spies, 2 <= n <= 1000000. The spies are numbered from 1 to n. In the following n lines there is a description of whom each agent spies. Each of these lines contains one positive integer. A number ak situated in line no. k + 1 indicates, that the spy no. k shadows the spy no. ak, 1 <= k <= n, 1 <= ak <= n, ak <> k.

Output

Your programme should write one integer in the first line of the output - the maximal number of spies that can be assigned to the secret operation.

Example

For the following input data:

6
2
3
l
3
6
5

the correct answer is:

3

Example