func_code_string: #include <bits/stdc++.h>   using namespace std;   void solve();   int main() {     srand(time(0));     cout.setf(ios::fixed);     cout.precision(10);     int tn = 1;     for (int i = 0; i < tn; ++i) solve();   }   vector<int> g[100001];   const long long mod = 1000000007;   inline void add(long long &a, long long b) {     a += b;     a %= mod;   }   pair<long long, long long> dfs(int u) {     sort(g[u].begin(), g[u].end());     long long res[2][2][2];     memset(res, 0, sizeof(res));     res[1][0][0] = 1;     for (int i = 0; i < ((int)(g[u]).size()); ++i) {       pair<long long, long long> c = dfs(g[u][i]);       long long even = c.first;       long long odd = c.second;       long long cres[2][2][2];       for (int sum = 0; sum < 2; ++sum)         for (int was_odd = 0; was_odd < 2; ++was_odd)           for (int was_even = 0; was_even < 2; ++was_even)             cres[sum][was_odd][was_even] = res[sum][was_odd][was_even];       for (int sum = 0; sum < 2; ++sum)         for (int was_odd = 0; was_odd < 2; ++was_odd)           for (int was_even = 0; was_even < 2; ++was_even) {             add(res[sum ^ 1][1][was_even], odd * cres[sum][was_odd][was_even]);             add(res[sum][was_odd][1], even * cres[sum][was_odd][was_even]);           }     }     for (int sum = 0; sum < 2; ++sum)       for (int was_odd = 0; was_odd < 2; ++was_odd)         for (int was_even = 0; was_even < 2; ++was_even) {           if ((was_odd && sum == 1) || (was_even && sum == 0))             add(res[sum][was_odd][was_even], res[sum][was_odd][was_even]);         }     long long odd = 0, even = 0;     for (int was_odd = 0; was_odd < 2; ++was_odd)       for (int was_even = 0; was_even < 2; ++was_even) {         add(odd, res[1][was_odd][was_even]);         add(even, res[0][was_odd][was_even]);       }     return make_pair(even, odd);   }   void solve() {     int n;     cin >> n;     for (int i = 0; i < n - 1; ++i) {       int p;       cin >> p;       --p;       g[p].push_back(i + 1);     }     pair<long long, long long> res = dfs(0);     cout << (res.first + res.second) % mod <<   n ;   }   