B. Cooperative Game on a Tree
time limit per test
1 s
memory limit per test
512 megabytes
input
standard input
output
standard output

Sergey and Azat enjoy playing board games. After many hours spent in fierce battles against each other, the guys got tired and decided to try playing cooperative games—in these games, players must cooperate with each other to achieve the best possible result. Luckily for the boys, Azat had just recently been gifted one such game.

In this game, there is a rooted tree with $$$n$$$ vertices with the root at vertex $$$1$$$, as well as a set of chips — one blue and many red. Initially, one blue and one red chip are placed in vertex $$$1$$$. Next, the following steps are taken:

  1. The first player moves the blue chip from its current vertex to one of its children.
  2. If the blue chip ends up in a leaf (i.e., a vertex that has no children), the game ends.
  3. The second player does the same with the red chip: he moves it from its current vertex to one of its children.
  4. If the red chip ends up in a leaf, it stays there permanently and can no longer be moved, but a new red chip is placed in the vertex where the blue chip currently is. After that, the game continues from step $$$1$$$.

The goal of the game is to end up with as many red chips on the tree as possible. However, the game developers did not specify what the best possible result in the game could be, so the guys are asking you to calculate this information.

Input

The first line contains the number $$$n$$$ ($$$2 \le n \le 2\cdot 10^5$$$) — the number of vertices in the tree. The next line specifies $$$n-1$$$ numbers $$$p_2, p_3, \ldots p_n$$$, where the number $$$p_i$$$ means that vertex $$$i$$$ is a child of vertex $$$p_i$$$ ($$$1 \le p_i \lt i$$$).

Output

Print a single number — the maximum number of red chips that can end up on the tree at the end of the game.

Examples
Input
4
1 1 3
Output
2
Input
3
1 2
Output
1
Note

In the first example, the optimal sequence of actions is as follows: the first player moves his chip to vertex $$$3$$$, and the second player moves his one to vertex $$$2$$$. After that, a new red chip appears in vertex $$$3$$$, the first player moves the blue chip to vertex $$$4$$$ and the game ends there.