#include <bits/stdc++.h>
using namespace std;
int Case, n, fa[300001], f[300001][2], g[300001][2][2];
vector<int> G[300001];
inline int Mod(int x) { return x >= 1000000007 ? x - 1000000007 : x; }
inline void dfs(int x) {
  int a, b, c;
  g[x][0][0] = g[x][0][1] = f[x][1] = 1;
  for (int y : G[x]) {
    dfs(y);
    a = (1ll * f[y][0] * f[x][0] + 1ll * f[y][1] * f[x][1]) % 1000000007,
    b = (1ll * f[y][0] * f[x][1] + 1ll * f[y][1] * f[x][0]) % 1000000007;
    f[x][0] = Mod(f[x][0] + a), f[x][1] = Mod(f[x][1] + b);
    a = 1ll * g[x][0][0] * f[y][0] % 1000000007,
    b = 1ll * g[x][1][1] * f[y][1] % 1000000007,
    c = 1ll * g[x][0][1] * f[y][1] % 1000000007;
    g[x][0][0] = Mod(g[x][0][0] + a), g[x][0][1] = Mod(g[x][0][1] + b),
    g[x][1][1] = Mod(g[x][1][1] + c);
  }
  f[x][0] = (2ll * f[x][0] - g[x][1][1] + 1000000007) % 1000000007,
  f[x][1] = (2ll * f[x][1] - g[x][0][0] + 1000000007) % 1000000007;
}
signed main(void) {
  int i;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i)
    G[i].clear(), f[i][0] = f[i][1] = g[i][0][0] = g[i][0][1] = g[i][1][0] =
                      g[i][1][1] = 0;
  for (i = 2; i <= n; ++i) scanf("%d", fa + i), G[fa[i]].push_back(i);
  dfs(1);
  printf("%d\n", Mod(f[1][0] + f[1][1]));
  return 0;
}
