#include <bits/stdc++.h>
using std::bitset;
using std::cin;
using std::complex;
using std::cout;
using std::endl;
using std::fixed;
using std::greater;
using std::ios_base;
using std::lower_bound;
using std::make_pair;
using std::map;
using std::max;
using std::min;
using std::multiset;
using std::next_permutation;
using std::ostream;
using std::pair;
using std::prev_permutation;
using std::random_shuffle;
using std::reverse;
using std::set;
using std::setprecision;
using std::sort;
using std::string;
using std::swap;
using std::upper_bound;
using std::vector;
template <class C>
void mini(C& a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C& a4, C b4) {
  a4 = max(a4, b4);
}
template <class T1, class T2>
ostream& operator<<(ostream& out, pair<T1, T2> pair) {
  return out << "(" << pair.first << ", " << pair.second << ")";
}
const long long N = 1e5 + 5;
const long long P = 1e9 + 7;
long long dp[N][2];
vector<long long> slo[N];
long long p[N];
void Dfs(long long v) {
  for (auto nei : slo[v]) {
    Dfs(nei);
  }
  long long dp_all[2] = {};
  long long dp_even = 1;
  long long dp_odd_even = 1;
  long long dp_odd_odd = 0;
  dp_all[1] = 1;
  for (auto nei : slo[v]) {
    dp_even = (dp_even * dp[nei][0]) % P;
    long long tmp = dp_odd_even;
    dp_odd_even = (dp_odd_even + dp_odd_odd * dp[nei][1]) % P;
    dp_odd_odd = (dp_odd_odd + tmp * dp[nei][1]) % P;
    long long new_dp[2] = {};
    for (long long par_so_far = 0; par_so_far < (2); ++par_so_far) {
      for (long long son_par = 0; son_par < (2); ++son_par) {
        new_dp[par_so_far ^ son_par] += dp_all[par_so_far] * dp[nei][son_par];
      }
    }
    for (long long i = 0; i < (2); ++i) {
      dp_all[i] = new_dp[i] % P;
    }
  };
  ;
  ;
  ;
  dp[v][0] = (1 + 2 * dp_all[0] - dp_odd_odd + P) % P;
  dp[v][1] = (2 * dp_all[1] - dp_even + P) % P;
  ;
  ;
  ;
  ;
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  double beg_clock = 1.0 * clock() / CLOCKS_PER_SEC;
  long long n;
  cin >> n;
  ;
  for (long long i = (2); i <= (n); ++i) {
    cin >> p[i];
    slo[p[i]].push_back(i);
  }
  Dfs(1);
  cout << (dp[1][0] + dp[1][1] + P - 1) % P << endl;
  return 0;
}
