Bobo proposes a multiplication operation on rooted trees.
Let A and B be two arbitrary rooted trees. Then T=A⋅B is built by making a copy of B for each vertex x∈A and merging the root of this copy with x (see the following figure for more details). We then call A and B factors of T.

Apparently, we have T⋅1=1⋅T=T, where 1 is the rooted tree with only one vertex. So, 1 is a factor of every rooted tree, and every rooted tree is a factor of itself. And if a rooted tree T only has T and 1 as his factors, we call T a prime tree.
Bobo has a rooted tree T with n nodes which are conveniently labeled with 1,2,…,n. He wants to factor T into multiplication of as many prime trees as possible (that is, find an equation T=T_1⋅T_2⋯T_m where T_i (1≤i≤m) are prime trees and m is maximum).
Note that 1 is not a prime tree.
The input contains zero or more test cases, and is terminated by end-of-file. For each test case:
The first line contains an integer n, the number of nodes (2≤n≤106).
The second line contains (n−1) integers p_2,p_3,…,p_n, where p_i is the parent of the i-th node (1≤p_i≤i−1).
It is guaranteed that the sum of all n does not exceed 106.
For each test case, output an integer denoting the maximum number of prime factors.