#include <bits/stdc++.h>
template <typename T>
void read(T &x);
template <typename T>
void read(T &x, T &y);
template <typename T>
void read(T &x, T &y, T &z);
template <typename T>
void write(T x);
template <typename T>
void writeC(T x);
template <typename T>
void writeN(T x);
const int mod = 1e9 + 7;
int f[200005][2], dp[200005][2], fa[200005], n, size[200005];
std::vector<int> ch[200005];
void dfs(int u) {
  f[u][1] = 1;
  for (int v : ch[u]) {
    dfs(v);
    int x = f[u][0], y = f[u][1];
    f[u][0] =
        ((long long)x * (f[v][0] + 1) % mod + (long long)y * (f[v][1]) % mod) %
        mod;
    f[u][1] =
        ((long long)x * (f[v][1]) % mod + (long long)y * (f[v][0] + 1) % mod) %
        mod;
  }
  f[u][0] = f[u][0] * 2 % mod;
  f[u][1] = f[u][1] * 2 % mod;
  int cw = 1, c = ch[u].size();
  for (int i = 0; i <= c; ++i) dp[i][0] = dp[i][1] = 0;
  dp[0][0] = 1;
  for (int i = 1; i <= c; ++i) {
    int v = ch[u][i - 1];
    cw = (cw + (long long)cw * f[v][0] % mod) % mod;
    for (int j = 0; j < 2; ++j)
      dp[i][j] =
          (dp[i - 1][j] + (long long)dp[i - 1][j ^ 1] * f[v][1] % mod) % mod;
  }
  f[u][1] = (f[u][1] - cw + mod) % mod;
  f[u][0] = (f[u][0] - dp[c][1] + mod) % mod;
}
int main() {
  read(n);
  for (int i = (2); i <= (n); ++i) {
    read(fa[i]);
    ch[fa[i]].push_back(i);
  }
  dfs(1);
  printf("%d", (f[1][1] + f[1][0]) % mod);
  return 0;
}
template <typename T>
void read(T &x) {
  x = 0;
  char c = getchar();
  T flag = 1;
  while (c < '0' || c > '9') {
    if (c == '-') flag = -flag;
    c = getchar();
  }
  while ('0' <= c && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= flag;
}
template <typename T>
void read(T &x, T &y) {
  read(x);
  read(y);
}
template <typename T>
void read(T &x, T &y, T &z) {
  read(x);
  read(y);
  read(z);
}
template <typename T>
void writeC(T x) {
  if (x < 0) x = ~x + 1, putchar('-');
  if (x > 9) writeC(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void write(T x) {
  writeC(x);
  putchar(' ');
}
template <typename T>
void writeN(T x) {
  writeC(x);
  puts("");
}
