#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
vector<int> G[2000];
int B[2000];
int fact[2001];
vector<int> dp[2000][2];
vector<int> dp2[2][3];

vector<int> merge(vector<int> &a, vector<int> &b) {
  vector<int> o(a.size()+b.size()-1, 0);
  rep(i, a.size()) {
    rep(j, b.size()) {
      o[i+j] = (o[i+j] + 1LL*a[i]*b[j])%MOD;
    }
  }
  return o;
}
void add(vector<int> &to, vector<int> src) {
  if (to.size() < src.size()) to.resize(src.size(), 0);
  rep(i, src.size()) to[i] = (to[i]+src[i]) % MOD;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  fact[0] = 1;
  for (int i=1; i<=2000; i++) fact[i] = (1LL*i*fact[i-1])%MOD;

  cin >> N;
  for (int i=1; i<N; i++) {
    int p;
    cin >> p;
    p--;
    G[p].pb(i);
  }
  for (int x=N-1; x>=0; x--) {
    dp2[0][0] = {1};
    dp2[0][1] = {0};
    dp2[0][2] = {0};
    for (int t : G[x]) {
      rep(k, 3) dp2[1][k].clear();
      rep(k, 3) add(dp2[1][k], merge(dp2[0][k], dp[t][0]));
      rep(k, 2) add(dp2[1][k+1], merge(dp2[0][k], dp[t][1]));
      swap(dp2[0], dp2[1]);
    }
    add(dp[x][1], dp2[0][0]);
    add(dp[x][1], dp2[0][1]);
    dp[x][1].insert(dp[x][1].begin(), 0); // s++

    add(dp[x][0], dp2[0][0]);
    for (int &x : dp2[0][1]) x = (2LL*x) % MOD;
    for (int &x : dp2[0][2]) x = (2LL*x) % MOD;
    add(dp[x][0], dp2[0][1]);
    add(dp[x][0], dp2[0][2]);
  }
  int sum = 0;
  for (int s=0; s<dp[0][0].size(); s++) {
    int e = dp[0][0][s];
    if (s%2) e = (MOD-e) % MOD;
    sum = (sum + 1LL*e*fact[N-s])%MOD;
  }
  cout << sum << "\n";
  return 0;
}
