#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 2005;
const int mod = 1e9 + 7;

int n, siz[MAXN], g[MAXN][3], f[MAXN][MAXN][3];
vector <int> adj[MAXN];

inline void DFS(int x)
{
	siz[x] = 1, f[x][1][0] = 1;
	for (auto y : adj[x])
	{
		DFS(y), mcpy(g, f[x]), mset(f[x], 0);
		for (int dx = 0; dx <= 2; dx ++)
			for (int dy = 0; dy <= 2; dy ++)
				for (int dz = 0; dz <= 1; dz ++)
					if (!dz || (dx < 2 && dy < 2))
						for (int i = 1; i <= siz[x]; i ++)
							for (int j = 1; j <= siz[y]; j ++)
							{
								int cur = 1;
								if (dz)
								{
									cur = mod - 1;
									if (!dx && !dy)
										cur = (cur << 1) % mod;
									if (dx && dy)
										cur = cur >> 1;
								}
								f[x][i + j - dz][dx + dz] = (1LL * g[i][dx] * f[y][j][dy] % mod * cur + f[x][i + j - dz][dx + dz]) % mod;
							}
		siz[x] += siz[y];
	}
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read();
	for (int i = 2; i <= n; i ++)
		adj[Read()].pb(i);
	DFS(1);
	int ret = 0;
	for (int i = 0, cur = 1; i <= n; i ++, cur = 1LL * cur * i % mod)
		for (int j = 0; j <= 2; j ++)
			ret = (1LL * f[1][i][j] * cur + ret) % mod;
	return printf("%d\n", ret), 0;
}
