Officials

No attempts yetTime limit1sMemory limit512 MB

Problem

Lately, things have not been going well in Byteland (Bajtocja). Bitogrom, a king consumed by an obsessive fear for his own life, came to power. Only a few days after taking the throne he revealed his ruthless nature, beheading five courtiers suspected of plotting against him. Every official in the country came to fear for their life. They knew that a single denunciation from a superior leads to a swift execution. What made things worse was that whoever informed on someone became a trusted man of the king and was therefore no longer at risk of a death sentence. In the terrified community of state officials, this was motivation enough to denounce one of their own subordinates.

This situation among the officials greatly worried Professor Bajtoszewski, who foresaw the resulting disruptions to the running of the state's sectors. He asked you to compute the maximum number of officials that can be executed as a result of denunciations. The professor explained the rules of how the state works in more detail:

  • Each of the nn officials in the country has a unique identifier that is an integer in the range [1,n][1, n].
  • Every superior has a number smaller than the numbers of all of their subordinates.
  • The superior of all officials is the prime minister of Byteland, who has number 1 and therefore has no superior.
  • Each official denounces at most one of their subordinates, because after the first denunciation they are already a trusted man of the king.
  • Byteland follows the principle "a subordinate of my subordinate is my subordinate", which in practice means that an official may denounce someone for whom they are only an indirect superior.

Input

The first line contains a single integer nn (1n10000001 \le n \le 1\,000\,000), the number of officials. The second line contains n1n-1 integers, of which the ii-th is the number of the superior of the official with number i+1i+1.

Output

In the first and only line, print a single integer equal to the maximum number of officials that can be executed as a result of denunciations.

Hint

Explanation of the sample: In the sample above, official 1 denounces official 3 and official 2 denounces official 4, so two officials are executed.

Note that an official who denounces someone becomes a trusted man of the king and can no longer be executed, so an official can either denounce a subordinate (and stay safe) or be executed, but not both.