#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
  if (a > b) {
    return a;
  } else {
    return b;
  }
}
long long min(long long a, long long b) {
  if (a < b) {
    return a;
  } else {
    return b;
  }
}
struct P {
  double x, y;
  P() {}
  P(double x, double y) : x(x), y(y) {}
  P operator+(const P &a) const { return P(x + a.x, y + a.y); }
  P operator-(const P &a) const { return P(x - a.x, y - a.y); }
  double operator^(const P &a) const { return x * a.x + y * a.y; }
  void in() { scanf("%lf%lf", &x, &y); }
  void out() { printf("REQUIRED %.7f %.7f\n", x, y); }
  double dist(P a, P b) {
    return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
  }
  double sqdist(P a, P b) {
    return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
  }
};
int n, p[100301];
int nxt[2000301], dir[2000301], h;
long long dp[100301][2][2];
void insert(int u, int v) {
  nxt[++h] = nxt[u];
  nxt[u] = h;
  dir[h] = v;
}
int lis[100301], cnt;
long long solve(int a, int b, int c) {
  if (nxt[a] == -1) {
    if (b == c)
      return 0;
    else
      return 1;
  }
  if (dp[a][b][0] == -1) {
    long long dp2[2][2][2];
    dp[a][b][0] = dp[a][b][1] = 0;
    for (int i = (0); i <= (1); i++)
      for (int j = (0); j <= (1); j++)
        for (int k = (0); k <= (1); k++) dp2[i][j][k] = 0;
    int w = 0;
    dp2[0][1 - b][b] = solve(dir[nxt[a]], 1 - b, b);
    dp2[0][1 - b][1 - b] = (solve(dir[nxt[a]], 1 - b, 1 - b) + 1) % 1000000007;
    for (int po = nxt[nxt[a]]; po > 0; po = nxt[po]) {
      w = 1 - w;
      for (int j = (0); j <= (1); j++)
        for (int k = (0); k <= (1); k++) {
          int sign = 0;
          if (j == k) sign = 1;
          dp2[w][j][k] = (solve(dir[po], j, k) + sign) *
                         (dp2[1 - w][0][j] + dp2[1 - w][1][j]) % 1000000007;
        }
    }
    dp[a][b][0] = (dp2[w][0][0] + dp2[w][1][0]) % 1000000007;
    dp[a][b][1] = (dp2[w][0][1] + dp2[w][1][1]) % 1000000007;
    for (int i = (0); i <= (1); i++)
      for (int j = (0); j <= (1); j++)
        for (int k = (0); k <= (1); k++) dp2[i][j][k] = 0;
    long long pp = (solve(dir[nxt[a]], 1 - b, 1 - b) + 1) % 1000000007;
    for (int po = nxt[nxt[a]]; po > 0; po = nxt[po]) {
      pp = (solve(dir[po], 1 - b, 1 - b) + 1) * pp % 1000000007;
    }
    dp[a][b][1 - b] -= pp;
    if (dp[a][b][1 - b] < 0) dp[a][b][1 - b] += 1000000007;
    dp2[0][1 - b][b] = solve(dir[nxt[a]], 1 - b, b);
    dp2[0][1 - b][1 - b] = 1;
    w = 0;
    for (int po = nxt[nxt[a]]; po > 0; po = nxt[po]) {
      w = 1 - w;
      for (int j = (0); j <= (1); j++)
        for (int k = (0); k <= (1); k++) {
          int sign = 0;
          if (j == k)
            sign = 1;
          else
            sign = solve(dir[po], j, k);
          dp2[w][j][k] =
              (dp2[1 - w][0][j] + dp2[1 - w][1][j]) * sign % 1000000007;
        }
    }
    dp[a][b][b] -= ((dp2[w][0][b] + dp2[w][1][b]) % 1000000007);
    if (dp[a][b][b] < 0) dp[a][b][b] += 1000000007;
    cnt = 0;
    for (int po = nxt[a]; po > 0; po = nxt[po]) {
      lis[++cnt] = dir[po];
    }
    nxt[a] = -1;
    for (int i = (cnt); i >= (1); i--) {
      insert(a, lis[i]);
    }
    for (int i = (0); i <= (1); i++)
      for (int j = (0); j <= (1); j++)
        for (int k = (0); k <= (1); k++) dp2[i][j][k] = 0;
    w = 0;
    dp2[0][1 - b][b] = solve(dir[nxt[a]], 1 - b, b);
    dp2[0][1 - b][1 - b] = (solve(dir[nxt[a]], 1 - b, 1 - b) + 1) % 1000000007;
    for (int po = nxt[nxt[a]]; po > 0; po = nxt[po]) {
      w = 1 - w;
      for (int j = (0); j <= (1); j++)
        for (int k = (0); k <= (1); k++) {
          int sign = 0;
          if (j == k) sign = 1;
          dp2[w][j][k] = (solve(dir[po], j, k) + sign) *
                         (dp2[1 - w][0][j] + dp2[1 - w][1][j]) % 1000000007;
        }
    }
    dp[a][b][0] = (dp[a][b][0] + dp2[w][0][0] + dp2[w][1][0]) % 1000000007;
    dp[a][b][1] = (dp[a][b][1] + dp2[w][0][1] + dp2[w][1][1]) % 1000000007;
  }
  return dp[a][b][c];
}
int main() {
  scanf("%d", &n);
  h = n;
  for (int i = (1); i <= (n); i++) nxt[i] = -1;
  for (int i = (2); i <= (n); i++) {
    scanf("%d", &p[i]);
  }
  for (int i = (n); i >= (2); i--) {
    insert(p[i], i);
  }
  for (int i = (1); i <= (n); i++)
    for (int j = (0); j <= (1); j++)
      for (int k = (0); k <= (1); k++) dp[i][j][k] = -1;
  long long res = (solve(1, 0, 0) + solve(1, 0, 1)) % 1000000007;
  printf("%I64d\n", res);
  return 0;
}
