#include <cstdio>
#include <cstring>
#include <vector>

const int N = 2000;
const int MOD = (int)1e9 + 7;

int n, fact[N + 1], size[N], dp[N][3][N];
std::vector<int> children[N];

void update(int& x, int a)
{
    x += a;
    if (x >= MOD) {
        x -= MOD;
    }
}

void dfs(int u)
{
    static int tmp[3][N];

    size[u] = 1;
    dp[u][0][0] = 1;
    for (auto v : children[u]) {
        dfs(v);
        int ns = size[u] + size[v];
        for (int t = 0; t < 3; ++ t) {
            memset(tmp[t], 0, sizeof(int) * ns);
        }
        for (int t = 0; t < 3; ++ t) {
            for (int x = 0; x < size[u]; ++ x) {
                if (!dp[u][t][x]) {
                    continue;
                }
                for (int y = 0; y < size[v]; ++ y) {
                    for (int tt = 0; tt < 3; ++ tt) {
                        if (!dp[v][tt][y]) {
                            continue;
                        }
                        auto pd = 1LL * dp[u][t][x] * dp[v][tt][y] % MOD;
                        if (t < 2 && tt < 2) {
                            update(tmp[t + 1][x + y + 1], pd);
                        }
                        if (tt == 0) {
                            pd = 500000004LL * pd % MOD;
                        }
                        update(tmp[t][x + y], pd);
                    }
                }
            }
        }
        for (int t = 0; t < 3; ++ t) {
            memcpy(dp[u][t], tmp[t], sizeof(int) * ns);
        }
        size[u] += size[v];
    }
}

int main()
{
#ifdef LOCAL_JUDGE
    freopen("A.in", "r", stdin);
#endif
    scanf("%d", &n);
    fact[0] = 1;
    for (int i = 1; i <= n; ++ i) {
        fact[i] = 2LL * fact[i - 1] * i % MOD;
    }
    for (int i = 1, p; i < n; ++ i) {
        scanf("%d", &p);
        children[p - 1].push_back(i);
    }
    memset(dp, 0, sizeof(dp));
    dfs(0);
    int result = 0;
    for (int i = 0; i < n; ++ i) {
        int add = 1LL * fact[n - i] * (500000004LL * dp[0][0][i] % MOD + dp[0][1][i] + dp[0][2][i]) % MOD;
        if (i & 1) {
            add = MOD - add;
        }
        update(result, add);
    }
    printf("%d\n", result);
}
