#include <bits/stdc++.h>
using namespace std;
long long arreven[100005];
long long arrodd[100005];
long long even[100005], odd[100005], n;
vector<long long> children[100005];
void dfs(int x) {
  if (children[x].size() == 0) {
    even[x] = 0;
    odd[x] = 1;
    return;
  }
  for (int i = 0; i < children[x].size(); ++i) dfs(children[x][i]);
  arreven[0] = 1;
  arrodd[0] = 0;
  for (int i = 0; i < children[x].size(); ++i) {
    arreven[i + 1] = arreven[i] * (even[children[x][i]] + 1) +
                     arrodd[i] * odd[children[x][i]];
    arreven[i + 1] %= 1000000007;
    arrodd[i + 1] = arreven[i] * odd[children[x][i]] +
                    arrodd[i] * (even[children[x][i]] + 1);
    arrodd[i + 1] %= 1000000007;
  }
  even[x] = 2 * arrodd[children[x].size()];
  odd[x] = 2 * arreven[children[x].size()];
  long long prod = 1;
  for (int i = 0; i < children[x].size(); ++i)
    prod = (prod * (even[children[x][i]] + 1)) % 1000000007;
  odd[x] -= prod;
  odd[x] = (odd[x] + 1000000007) % 1000000007;
  arreven[0] = 1;
  arrodd[0] = 0;
  for (int i = 0; i < children[x].size(); ++i) {
    arreven[i + 1] = arreven[i] + arrodd[i] * odd[children[x][i]];
    arrodd[i + 1] = arreven[i] * odd[children[x][i]] + arrodd[i];
    arrodd[i + 1] %= 1000000007;
    arreven[i + 1] %= 1000000007;
  }
  even[x] -= arrodd[children[x].size()];
  even[x] = (even[x] + 1000000007) % 1000000007;
  return;
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int x;
    cin >> x;
    children[x - 1].push_back(i + 1);
  }
  for (int i = 0; i < n; ++i) even[i] = odd[i] = 0;
  dfs(0);
  cout << (odd[0] + even[0]) % 1000000007 << endl;
}
