#include <bits/stdc++.h>
const int mod = 1000000007;
std::vector<int> g[1111111];
int c[1111111];
int d[1111111];
void dfs(int x) {
  int tt;
  int cc, dd;
  int t1, t2;
  int i;
  c[x] = 1;
  cc = 0;
  dd = 1;
  tt = 1;
  for (i = 0; i < g[x].size(); i++) {
    dfs(g[x][i]);
    t1 = c[x];
    t2 = d[x];
    (c[x] += (1LL * t1 * d[g[x][i]] + 1LL * t2 * c[g[x][i]]) % mod) %= mod;
    (d[x] += (1LL * t1 * c[g[x][i]] + 1LL * t2 * d[g[x][i]]) % mod) %= mod;
    t1 = cc;
    t2 = dd;
    (cc += (1LL * t2 * c[g[x][i]]) % mod) %= mod;
    (dd += (1LL * t1 * c[g[x][i]]) % mod) %= mod;
    (tt += (1LL * tt * d[g[x][i]]) % mod) %= mod;
  }
  (c[x] *= 2) %= mod;
  (d[x] *= 2) %= mod;
  (d[x] += mod - cc) %= mod;
  (c[x] += mod - tt) %= mod;
}
int main() {
  int i, j, n;
  scanf("%d", &n);
  for (i = 2; i <= n; i++) {
    scanf("%d", &j);
    g[j].push_back(i);
  }
  dfs(1);
  printf("%d", (c[1] + d[1]) % mod);
}
