#include <bits/stdc++.h>
#define LL long long
#define INF (1ll<<60)//or 0x3f3f3f3f ?
using namespace std;

template<class T> inline
void read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')   {if (ch == '-') f = -1; ch = getchar();}
    while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
    x *= f;
}

/*============ Header Template ============*/

const int N = 250000 + 5;
// const int N = 200 + 5;
const int mo = 1000000007;

int n, m, tme, e = 1, k, ve, top, max_dep;
int first[N], vfirst[N], d[N], h[N];
int dfn[N], st[N], vis[N];
LL g[N][2], pw[N], ans;
int f[N][21];
LL a[N], PRE[N], NXT[N];
std::vector<int> V[N];

struct edge {int v, next;} s[2 * N], vs[2 * N];
void add(int u, int v) {
    s[e].next = first[u]; s[e].v = v; first[u] = e++;
    s[e].next = first[v]; s[e].v = u; first[v] = e++;
}

void addv(int u, int v) {
    // printf("%d %d\n", u, v);
    vs[ve].next = vfirst[u]; vs[ve].v = v; vfirst[u] = ve++;
}

void dfs(int u, int fa) {
    d[u] = d[fa] + 1; max_dep = max(max_dep, d[u]); V[d[u]].push_back(u);
    f[u][0] = fa; dfn[u] = ++tme;
    for (int e = first[u]; e; e = s[e].next) {
        int v = s[e].v;
        if (v == fa) continue;
        dfs(v, u);
    }
}

int cmp(const int& a, const int& b) {return dfn[a] < dfn[b];}

void pre() {
    for (int i = 1; i <= 20; i++)
        for (int j = 1; j <= n; j++) f[j][i] = f[f[j][i - 1]][i - 1];
}

int LCA(int x, int y) {
    if (d[x] < d[y]) swap(x, y);
    for (int i = 20; i >= 0; i--)
        if (d[f[x][i]] >= d[y]) x = f[x][i];
    if (x == y) return x;
    for (int i = 20; i >= 0; i--)
        if (f[x][i] != f[y][i]) x = f[x][i], y = f[y][i];
    return f[x][0];
}

void dp(int u) {
    LL ALL = 1;
    if (!vfirst[u]) {
        g[u][0] = 1;
        g[u][1] = 1;
        return;
    } else {g[u][0] = g[u][1] = 0;}
    for (int e = vfirst[u]; e; e = vs[e].next) {
        int v = vs[e].v; dp(v);
        ALL = ALL * ((g[v][0] + g[v][1]) % mo) % mo;
    }
    int num = 0;
    for (int e = vfirst[u]; e; e = vs[e].next) {
        int v = vs[e].v;
        a[++num] = g[v][0];
    }
    PRE[0] = NXT[num + 1] = 1;
    for (int i = 1; i <= num; i++) PRE[i] = PRE[i - 1] * a[i] % mo;
    for (int i = num; i; i--) NXT[i] = NXT[i + 1] * a[i] % mo;
    for (int e = vfirst[u], t = 0; e; e = vs[e].next) {
        int v = vs[e].v; t++;
        (g[u][1] += PRE[t - 1] * NXT[t + 1] % mo * g[v][1] % mo) %= mo;
    }
    g[u][0] = (ALL - g[u][1]) % mo;
    vfirst[u] = 0;
}

void solve(int D) {
    // printf("D = %d\n", D);
    top = 0; ve = 1;
    k = V[D].size();
    for (int i = 0; i < V[D].size(); i++) h[i + 1] = V[D][i]; h[++k] = 1;
    sort(h + 1, h + k + 1, cmp); st[++top] = 1;
    for (int i = 1; i <= k; i++) {
        int x = h[i], lca = LCA(st[top], x);
        while (dfn[lca] < dfn[st[top]]) {
            if (dfn[st[top - 1]] <= dfn[lca]) {
                addv(lca, st[top--]);
                if (st[top] != lca) st[++top] = lca;
                break;
            }
            addv(st[top - 1], st[top]); top--;
        }
        if (st[top] != x) st[++top] = x;
    }
    while (top >= 2) addv(st[top - 1], st[top]), top--;
    dp(1); (ans += pw[n - V[D].size()] * g[1][1] % mo) %= mo;
}

int main() {
    read(n);
    pw[0] = 1;
    for (int i = 1; i <= n + 1; i++) pw[i] = pw[i - 1] * 2 % mo; n++;
    for (int i = 2, u, v; i <= n; i++) {u = i, read(v); v++; add(u, v);}
    dfs(1, 0); pre();
    for (int i = 1; i <= max_dep; i++) solve(i);
    printf("%lld\n", (ans + mo) % mo);
    return 0;
}

Measured memory_bytes: 63744