#include using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; #define rep(i,n) for(ll i=0;i T div_floor(T a, T b) { return a / b - ((a ^ b) < 0 && a % b); } template T div_ceil(T a, T b) { return a / b + ((a ^ b) > 0 && a % b); } template inline bool chmin(T &x, U y) { return (y < x) ? (x = y, true) : false; } template inline bool chmax(T &x, U y) { return (x < y) ? (x = y, true) : false; } template ostream &operator<<(ostream &os, const vector &a){ if (a.empty()) return os; os << a.front(); for (auto e : a | views::drop(1)){ os << ' ' << e; } return os; } void dump(auto ...vs){ ((cout << vs << ' '), ...) << endl; } #include using namespace atcoder; using mint = modint998244353; void solve() { ll N; cin>>N; vector> edge(N); vector par(N,-1); rep(i,N-1){ ll p; cin>>p; p--; edge[p].push_back(i+1); par[i+1]=p; } mint ans=0; { auto dfs=[&](auto self,ll cp)->vector { vector r(2,0); r[0]=1; for (ll np:edge[cp]){ vector res=self(self,np); vector nr((ll)r.size()+res.size()-1,0); rep(i,(ll)r.size()){ rep(j,(ll)res.size()){ nr[i+j]+=r[i]*res[j]; } } swap(r,nr); } rep(i,(ll)r.size()-1){ r[i+1]+=r[i]; } return r; }; vector r=dfs(dfs,0); rep(i,(ll)r.size()){ ans+=r[i]; } } cout<sync_with_stdio(0); ll T=1; while (T--){ solve(); } return 0; }