Roads Improvement#10684

Roads Improvement

1 second
128 megabytes
Very easy

There are cities in the country and n - 1 bidirectional roads, such that it is possible to travel from any city to any other city using only these roads. The cities are numbered with integers from to inclusive.

Initially, all roads are considered to be in bad condition, but the government plans to improve the state of some of them. The citizens will be satisfied with the improvements if there is no more than one bad road on the path from the capital, located in city , to any other city.

Determine the number of ways to improve the quality of some roads to meet this requirement. Since the answer can be very large, output it modulo 10^9 + 7.

Input

The first line contains a single integer n~(2 \le n \le 2 \cdot 10^5) — the number of cities in the country. The second line contains n - 1 positive integers p_2, p_3, p_4, \cdots, p_n~(1 \le p_i \le i - 1), describing the roads in the country. The number p_i indicates that there is a road connecting city p_i and city .

Output

Print the number of ways to improve the quality of the roads modulo 10^9 + 7.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading