#include <bits/stdc++.h>
using namespace std;
const int N = 200000;
const long long MOD = 1000000007LL;
int n;
vector<int> c[N];
int p[N];
long long dp[N][2];
void dfs(int v) {
  dp[v][1] = 1;
  for (int i = 0; i < (int)c[v].size(); i++) {
    dfs(c[v][i]);
    long long dpv0 =
        (dp[c[v][i]][0] * dp[v][0] + dp[c[v][i]][1] * dp[v][1]) % MOD;
    long long dpv1 =
        (dp[c[v][i]][0] * dp[v][1] + dp[c[v][i]][1] * dp[v][0]) % MOD;
    dp[v][0] = dpv0;
    dp[v][1] = dpv1;
  }
  dp[v][0] = (2 * dp[v][0]) % MOD;
  dp[v][1] = (2 * dp[v][1]) % MOD;
  long long e = 1, o[2] = {1, 0};
  for (int i = 0; i < (int)c[v].size(); i++) {
    e = (e * dp[c[v][i]][0]) % MOD;
    long long o0 = (o[1] * dp[c[v][i]][1] + o[0]) % MOD;
    long long o1 = (o[0] * dp[c[v][i]][1] + o[1]) % MOD;
    o[0] = o0;
    o[1] = o1;
  }
  dp[v][1] = (dp[v][1] - e + MOD) % MOD;
  dp[v][0] = (dp[v][0] - o[1] + MOD) % MOD;
  dp[v][0]++;
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &p[i]);
    c[p[i]].push_back(i);
  }
  dfs(1);
  printf("%I64d\n", (dp[1][0] + dp[1][1] + MOD - 1) % MOD);
  return 0;
}
