#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
const long double EPS = 1e-12;
const int INF = 1e9 + 10;
const long long LINF = 1000ll * 1000 * 1000 * 1000 * 1000 * 1000 + 100;
const int MN = 1e5 + 10;
const int MOD = 1e9 + 7;
int n;
int dp[2][MN];
vector<int> child[MN], pre[2][MN], suf[2][MN];
int odd[2][MN], even[MN];
void input() {
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int t;
    cin >> t;
    child[t - 1].push_back(i);
    pre[0][t - 1].push_back(0), suf[0][t - 1].push_back(0);
    pre[1][t - 1].push_back(0), suf[1][t - 1].push_back(0);
  }
}
void cal(int s) {
  even[0] = 1 + dp[0][child[s][0]];
  for (int i = 1; i < ((int)(child[s]).size()); ++i)
    even[i] =
        (1ll * even[i - 1] + 1ll * even[i - 1] * dp[0][child[s][i]]) % MOD;
  odd[0][0] = 1, odd[1][0] = dp[1][child[s][0]];
  for (int i = 1; i < ((int)(child[s]).size()); ++i) {
    odd[1][i] =
        (1ll * odd[1][i - 1] + 1ll * odd[0][i - 1] * dp[1][child[s][i]]) % MOD;
    odd[0][i] =
        (1ll * odd[0][i - 1] + 1ll * odd[1][i - 1] * dp[1][child[s][i]]) % MOD;
  }
  int t = ((int)(child[s]).size());
  dp[0][s] =
      ((1ll * pre[1][s][t - 1] + suf[1][s][0] - odd[1][t - 1]) % MOD + MOD) %
      MOD;
  dp[1][s] =
      ((1ll * pre[0][s][t - 1] + suf[0][s][0] - even[t - 1]) % MOD + MOD) % MOD;
}
void dfs(int s) {
  if (child[s].empty()) {
    dp[1][s] = 1;
    return;
  }
  for (int i = 0; i < ((int)(child[s]).size()); ++i) dfs(child[s][i]);
  for (int i = 0; i < ((int)(child[s]).size()); ++i) {
    int v = child[s][i];
    if (!i) {
      pre[0][s][i] = dp[0][v] + 1, pre[1][s][i] = dp[1][v];
      continue;
    }
    pre[0][s][i] =
        ((1ll * dp[0][v] * pre[0][s][i - 1]) % MOD +
         (1ll * dp[1][v] * pre[1][s][i - 1]) % MOD + pre[0][s][i - 1]) %
        MOD;
    pre[1][s][i] =
        ((1ll * dp[0][v] * pre[1][s][i - 1]) % MOD +
         (1ll * dp[1][v] * pre[0][s][i - 1]) % MOD + pre[1][s][i - 1]) %
        MOD;
  }
  for (int i = ((int)(child[s]).size()) - 1; i >= 0; --i) {
    int v = child[s][i];
    if (i == ((int)(child[s]).size()) - 1) {
      suf[0][s][i] = dp[0][v] + 1, suf[1][s][i] = dp[1][v];
      continue;
    }
    suf[0][s][i] =
        ((1ll * dp[0][v] * suf[0][s][i + 1]) % MOD +
         (1ll * dp[1][v] * suf[1][s][i + 1]) % MOD + suf[0][s][i + 1]) %
        MOD;
    suf[1][s][i] =
        ((1ll * dp[0][v] * suf[1][s][i + 1]) % MOD +
         (1ll * dp[1][v] * suf[0][s][i + 1]) % MOD + suf[1][s][i + 1]) %
        MOD;
  }
  cal(s);
}
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  input();
  dfs(0);
  cout << (1ll * dp[0][0] + dp[1][0]) % MOD << '\n';
  return 0;
}
