func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e6 + 100;   const int MOD = 1e9 + 7;   vector<long long> child[MAXN];   long long dpzooj[MAXN];   long long dpfard[MAXN];   void dfs(long long v) {     if (child[v].size() == 0) {       dpzooj[v] = 1, dpfard[v] = 1;       return;     }     for (auto u : child[v]) dfs(u);     long long tempzooj = 1;     long long tempfard = 0;     long long fardtafard = 0;     long long zoojtafard = 1;     long long hamezooj = 1;     for (auto u : child[v]) {       long long tempz = (tempfard * dpfard[u] + tempzooj * dpzooj[u]) % MOD;       long long tempf = (tempfard * dpzooj[u] + tempzooj * dpfard[u]) % MOD;       tempfard = tempf;       tempzooj = tempz;       long long ff = (fardtafard + zoojtafard * dpfard[u]) % MOD;       long long zf = (zoojtafard + fardtafard * dpfard[u]) % MOD;       fardtafard = ff;       zoojtafard = zf;       hamezooj = (hamezooj * dpzooj[u]) % MOD;     }     dpfard[v] = ((tempzooj - hamezooj + MOD) * 2 + hamezooj) % MOD;     dpzooj[v] = ((tempfard - fardtafard + MOD) * 2 + fardtafard + 1) % MOD;   }   int32_t main() {     long long n;     cin >> n;     for (long long i = 2; i <= n; i++) {       long long x;       cin >> x;       child[x].push_back(i);     }     dfs(1);     cout << (dpzooj[1] + dpfard[1] - 1 + MOD) % MOD;   }   