#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const int MAXN = 1010;
struct Node {
  vector<int> path;
  long long dp_odd, dp_even;
  Node() {
    dp_odd = 0;
    dp_even = 0;
  }
};
int n;
Node nodes[100005];
long long dp[100005][2];
long long dp2[100005][2];
void railgun(int p) {
  for (auto k : nodes[p].path) {
    railgun(k);
  }
  int len = nodes[p].path.size();
  if (len == 0) {
    nodes[p].dp_even = 0;
    nodes[p].dp_odd = 1;
  } else {
    dp[0][0] = dp2[0][0] = 1;
    dp[0][1] = dp2[0][1] = 0;
    for (int i = 1; i <= len; i++) {
      dp[i][0] = (dp[i - 1][0] * (nodes[nodes[p].path[i - 1]].dp_even + 1));
      if (dp[i][0] >= MOD) dp[i][0] %= MOD;
      dp[i][0] += dp[i - 1][1] * nodes[nodes[p].path[i - 1]].dp_odd;
      dp[i][1] = (dp[i - 1][0] * nodes[nodes[p].path[i - 1]].dp_odd);
      if (dp[i][1] >= MOD) dp[i][1] %= MOD;
      dp[i][1] += dp[i - 1][1] * (nodes[nodes[p].path[i - 1]].dp_even + 1);
      if (dp[i][0] >= MOD) dp[i][0] %= MOD;
      if (dp[i][1] >= MOD) dp[i][1] %= MOD;
    }
    for (int i = 1; i <= len; i++) {
      dp2[i][0] =
          dp2[i - 1][0] + nodes[nodes[p].path[i - 1]].dp_odd * dp2[i - 1][1];
      dp2[i][1] =
          dp2[i - 1][1] + nodes[nodes[p].path[i - 1]].dp_odd * dp2[i - 1][0];
      if (dp2[i][0] >= MOD) dp2[i][0] %= MOD;
      if (dp2[i][1] >= MOD) dp2[i][1] %= MOD;
    }
    nodes[p].dp_even = (dp[len][0] * 2) % MOD;
    nodes[p].dp_odd = (dp[len][1] * 2) % MOD;
    long long all_even = 1;
    for (auto k : nodes[p].path) {
      all_even *= (nodes[k].dp_even + 1);
      if (all_even >= MOD) all_even %= MOD;
    }
    nodes[p].dp_even -= all_even;
    nodes[p].dp_even += MOD;
    nodes[p].dp_even %= MOD;
    nodes[p].dp_odd -= dp2[len][1];
    nodes[p].dp_odd += MOD;
    nodes[p].dp_odd %= MOD;
    swap(nodes[p].dp_even, nodes[p].dp_odd);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  int t;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> t;
    nodes[t].path.push_back(i);
  }
  railgun(1);
  cout << (nodes[1].dp_even + nodes[1].dp_odd) % MOD << endl;
  return 0;
}
