There are $n$ students (numbered $1$ to $n$) playing a message-passing game. In the game, everyone has a fixed message-passing target, where the message-passing target of the student numbered $i$ is the student numbered $T_i$.
At the start of the game, each student only knows their own birthday. In each subsequent round, everyone simultaneously tells their current known birthday information to their respective message-passing target (Note: it is possible for a person to receive information from multiple people, but each person will only tell their information to one person, i.e., their own message-passing target). When a person learns their own birthday from someone else, the game ends. How many rounds can this game last in total?
Input
The input consists of two lines.
The first line contains one integer $n$, representing $n$ students.
The second line contains $n$ space-separated integers $T_1, T_2, \dots, T_n$, where the $i$-th integer represents that the message-passing target of the student numbered $i$ is the student numbered $T_i$, with $1 \le T_i \le n$ and $T_i \neq i$.
It is guaranteed that the game will always end.
Output
Output one line containing a single integer, representing the total number of rounds the game lasts.
Examples
Input 1
5 2 4 2 3 1
Output 1
3
Note 1
The game process is shown in the figure. After the 3rd round of the game, student 4 hears student 2 tell them their own birthday, so the answer is 3. Of course, after the 3rd round, student 2 and student 3 can also learn their own birthdays from their own information sources, which also meets the conditions for the game to end.
Input 2
(See message/message2.in in the problem directory)
Output 2
(See message/message2.ans in the problem directory)
Constraints
For 30% of the data, $n \le 200$; For 60% of the data, $n \le 2500$; For 100% of the data, $n \le 200000$.
Figure 1. The game process showing the message passing over 3 rounds.