func_code_string: #include <bits/stdc++.h>   using namespace std;   int N;   vector<int> Q[100010];   long long F[100010][2];   bool vis[100010];   void dfs(int u) {     if (vis[u]) return;     vis[u] = true, F[u][1] = 1LL, F[u][0] = 0LL;     if (!Q[u].size()) return;     long long d0, d1;     for (int i = 0; i < Q[u].size(); i++) {       int v = Q[u][i];       dfs(v);       d0 = (F[u][1] * F[v][1] + F[u][0] * F[v][0]) % 1000000007;       d1 = (F[u][1] * F[v][0] + F[u][0] * F[v][1]) % 1000000007;       F[u][0] = (F[u][0] + d0) % 1000000007;       F[u][1] = (F[u][1] + d1) % 1000000007;     }     long long p0 = 1LL, p1 = 1LL, p2 = 0LL;     for (int i = 0; i < Q[u].size(); i++) {       int v = Q[u][i];       p0 = (p0 + p0 * F[v][0]) % 1000000007;       long long tmp = p1;       p1 = (p1 + p2 * F[v][1]) % 1000000007;       p2 = (p2 + tmp * F[v][1]) % 1000000007;     }     F[u][0] = (F[u][0] * 2 - p2 + 1000000007) % 1000000007;     F[u][1] = (F[u][1] * 2 - p0 + 1000000007) % 1000000007;     return;   }   int main() {     scanf( %d , &N);     for (int i = 2; i <= N; i++) {       int x;       scanf( %d , &x);       Q[x].push_back(i);     }     memset(vis, false, sizeof(vis));     memset(F, 0, sizeof(F));     dfs(1);     cout << (F[1][0] + F[1][1]) % 1000000007 << endl;     return 0;   }   