#include <bits/stdc++.h>
using namespace std;
int P[1 << 18];
long long Even[1 << 18];
long long Odd[1 << 18];
vector<int> E[1 << 18];
int main() {
  int n;
  scanf("%d", &n);
  int i, j;
  P[0] = -1;
  for (i = (1); i < (n); ++i) {
    scanf("%d", &P[i]);
    --P[i];
    E[P[i]].push_back(i);
  }
  for (i = (n)-1; i >= (0); --i) {
    long long& e = Even[i];
    long long& o = Odd[i];
    long long prod = 1;
    long long oEven = 1;
    long long oOdd = 0;
    o = 1;
    e = 0;
    int cnt = int((E[i]).size());
    for (j = (0); j < (cnt); ++j) {
      int a = E[i][j];
      long long even = (o * Odd[a] + e * (Even[a] + 1)) % 1000000007;
      long long odd = (e * Odd[a] + o * (Even[a] + 1)) % 1000000007;
      prod = prod * (Even[a] + 1) % 1000000007;
      long long oe = (oEven + oOdd * Odd[a]) % 1000000007;
      long long oo = (oOdd + oEven * Odd[a]) % 1000000007;
      oEven = oe;
      oOdd = oo;
      e = even;
      o = odd;
    }
    e = (e + e + 1000000007 - oOdd) % 1000000007;
    o = (o + o + 1000000007 - prod) % 1000000007;
  }
  printf("%d\n", int((Even[0] + Odd[0]) % 1000000007));
  return 0;
};
