e-olymp
Competitions

July 12 - ADA Training

Road Improvement

The country has n cities and n - 1 bidirectional roads, it is possible to get from every city to any other one if you move only along the roads. The cities are numbered with integers from 1 to n inclusive.

All the roads are initially bad, but the government wants to improve the state of some roads. We will assume that the citizens are happy about road improvement if the path from the capital located in city 1 to any other city contains at most one bad road.

Determine the number of ways of improving the quality of some roads in order to meet the citizens' condition. As the answer can be large, print it modulo 1 000 000 007 (109 + 7).

Input

The first line contains a single integer n (2 ≤ n ≤ 2 * 105) — the number of cities in the country. Next line contains n - 1 positive integers p2, p3, p4, ..., pn (1 ≤ pi ≤ i - 1) — the description of the roads in the country. Number pi means that the country has a road connecting city pi and city i.

Output

Print the sought number of ways to improve the quality of the roads modulo 1 000 000 007 (109 + 7).

Time limit 1 second
Memory limit 128 MiB
Input example #1
3
1 1
Output example #1
4
Input example #2
6
1 2 2 1 5
Output example #2
15