func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 1e5 + 10, mod = 1e9 + 7;   long long n, dp[2][N], d[2][N], t[2][N];   vector<long long> ch[N];   void dfs(long long v) {     if (!ch[v].size()) {       dp[0][v] = 0;       dp[1][v] = 1;       return;     }     for (long long i : ch[v]) dfs(i);     d[0][0] = 1;     for (long long i = 1; i <= ch[v].size(); i++) {       long long u = ch[v][i - 1];       d[0][i] = ((dp[0][u] + 1) * d[0][i - 1] + dp[1][u] * d[1][i - 1]) % mod;       d[1][i] = ((dp[0][u] + 1) * d[1][i - 1] + dp[1][u] * d[0][i - 1]) % mod;     }     dp[0][v] = (2 * d[0][ch[v].size()]) % mod;     dp[1][v] = (2 * d[1][ch[v].size()]) % mod;     long long bad = dp[0][ch[v][0]] + 1;     for (long long i = 1; i < ch[v].size(); i++)       bad = (bad * (dp[0][ch[v][i]] + 1)) % mod;     dp[0][v] = (dp[0][v] - bad) % mod;     t[0][0] = 1;     t[1][0] = dp[1][ch[v][0]];     for (long long i = 1; i < ch[v].size(); i++) {       t[0][i] = (t[0][i - 1] + t[1][i - 1] * dp[1][ch[v][i]]) % mod;       t[1][i] = (t[1][i - 1] + t[0][i - 1] * dp[1][ch[v][i]]) % mod;     }     dp[1][v] = (dp[1][v] - t[1][(long long)ch[v].size() - 1]) % mod;     swap(dp[0][v], dp[1][v]);   }   int32_t main() {     cin >> n;     for (long long i = 1; i < n; i++) {       long long p;       cin >> p;       p--;       ch[p].push_back(i);     }     dfs(0);     cout << (((dp[0][0] + dp[1][0]) % mod) + mod) % mod;   }   