#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define P 1000000007
#define N 2010
int n;
int a[N];
vector<int> A[N];
int f[N][N][3];
int g[N][3];
int s[N];

void ff(int x) {
	s[x] ++;
	f[x][0][0] = 1;
	for (vector<int>::iterator i = A[x].begin(); i != A[x].end(); i ++) {
		ff(*i);
		for (int j = 0; j < s[x]; j ++)
			for (int jj = 0; jj < 3; jj ++) {
				g[j][jj] = f[x][j][jj];
				f[x][j][jj] = 0;
			}
		
		for (int j = 0; j < s[x]; j ++)
			for (int jj = 0; jj < 3; jj ++)
				for (int k = 0; k < s[*i]; k ++)
					for (int kk = 0; kk < 3; kk ++) {
						// no delete
						int s = (ll)g[j][jj]*f[*i][k][kk]%P;
						int pp = jj;
						if (kk == 1) s = s*2%P;
						(f[x][j+k][pp] += s) %= P;
						
						// delete
						if (jj == 2 || kk == 2) continue;
						s = (ll)g[j][jj]*f[*i][k][kk]%P;
						if (jj && kk) {s = s*2%P; pp = 2;}
						if (jj && !kk) {s = s*2%P; pp = 2;}
						if (!jj && kk) {pp = 1;}
						if (!jj && !kk) {pp = 1;}
						(f[x][j+k+1][pp] += s) %= P;
					}
		s[x] += s[*i];
	}
}

int F[N];

int main() {
	F[0] = 1;
	for (int i = 1; i < N; i ++) F[i] = (ll)F[i-1]*i%P;
	cin >> n;
	a[0] = -1;
	for (int i = 1; i < n; i ++) {
		cin >> a[i];
		a[i] --;
		A[a[i]].pb(i);
	}
	memset(f, 0, sizeof f);
	ff(0);
	int S = 0;
	for (int i = 0; i < s[0]; i ++)
		for (int ii = 0; ii < 3; ii ++) {
			int s = f[0][i][ii];
			if (ii == 1) s = s*2%P;
			if (i%2) s = (P-s)%P;
			s = (ll)s*F[n-i]%P;
			S = (S+s)%P;
		}
	cout << S << endl;
	return 0;
}