#abc263b. [abc263_b]Ancestor

[abc263_b]Ancestor

Problem Statement

There are NN people, called Person 11, Person 22, ldots\\ldots, Person NN.

The parent of Person ii (2leileN)(2 \\le i \\le N) is Person PiP_i. Here, it is guaranteed that Pi<iP_i < i.

How many generations away from Person NN is Person 11?

Constraints

  • 2leNle502 \\le N \\le 50
  • 1lePi<i(2leileN)1 \\le P_i < i(2 \\le i \\le N)
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN P2P_2 P3P_3 dots\\dots PNP_N

Output

Print the answer as a positive integer.


Sample Input 1

3
1 2

Sample Output 1

2

Person 22 is a parent of Person 33, and thus is one generation away from Person 33.

Person 11 is a parent of Person 22, and thus is two generations away from Person 33.

Therefore, the answer is 22.


Sample Input 2

10
1 2 3 4 5 6 7 8 9

Sample Output 2

9