#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cstdlib>
#include <iostream>

using namespace std;

#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N;
vector<int> ch[2020];

i64 modpow(i64 a, int p = MOD - 2)
{
	if (p == 0) return 1;
	i64 ret = modpow(a, p / 2);
	ret = ret * ret % MOD;

	if (p % 2 == 1) ret = ret * a % MOD;
	return ret;
}

i64 fact[2020], facti[2020];

vector<vector<i64>> join(vector<vector<i64>> &data, vector<i64> &ext0, vector<i64> &ext1)
{
	vector<vector<i64>> ret(3, vector<i64>(data[0].size() + ext0.size() - 1, 0LL));
	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < data[0].size(); ++j) {
			for (int k = 0; k < ext0.size(); ++k) {
				ADD(ret[i][j + k], data[i][j] * ext0[k]);

				if (i == 0) ADD(ret[i + 1][j + k], data[i][j] * ext1[k]);
				else if (i == 1) ADD(ret[i + 1][j + k], data[i][j] * ext1[k]  % MOD * facti[2]);
			}
		}
	}
	return ret;
}

vector<vector<i64>> solve(int p)
{
	vector<vector<i64>> ret(3, vector<i64>());
	ret[0].push_back(1LL);
	ret[1].push_back(0LL);
	ret[2].push_back(0LL);
	for (int q : ch[p]) {
		auto ans = solve(q);

		// extend
		vector<i64> ext0(ans[0].size() + 1, 0LL), ext1(ans[0].size() + 1, 0LL);
		for (int i = 0; i < ans[0].size(); ++i) {
			ADD(ext0[i], ans[0][i]);
			ADD(ext0[i], ans[1][i]);
			ADD(ext0[i], ans[2][i]);
			ADD(ext1[i + 1], ans[0][i] * 2);
			ADD(ext1[i + 1], ans[1][i]);
			// ADD(ext1[i], ans[2][i]);
		}
		ret = join(ret, ext0, ext1);
	}
	/*
	printf("%d\n", p);
	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < ret[0].size(); ++j) printf("%lld ", ret[i][j]);
		puts("");
	}
	puts("---");
	*/
	return ret;
}

int main()
{
	scanf("%d", &N);
	fact[0] = facti[0] = 1;
	for (int i = 1; i <= N; ++i) {
		fact[i] = fact[i - 1] * i % MOD;
		facti[i] = modpow(fact[i]);
	}
	for (int i = 1; i < N; ++i) {
		int p;
		scanf("%d", &p);
		--p;
		ch[p].push_back(i);
	}

	auto ans = solve(0);

	i64 ret = 0;
	for (int i = 0; i < N; ++i) {
		i64 val = 0;
		ADD(val, ans[0][i]);
		ADD(val, ans[1][i]);
		ADD(val, ans[2][i]);

		if (i % 2 == 1) val = MOD - val % MOD;
		ADD(ret, val * fact[N - i]);
	}
	printf("%lld\n", ret);

	return 0;
}
