#include using namespace std; const long long MOD = 998244353; int main(){ int N; cin >> N; vector p(N, -1); for (int i = 1; i < N; i++){ cin >> p[i]; p[i]--; } vector> c(N); for (int i = 1; i < N; i++){ c[p[i]].push_back(i); } vector bfs; vector d(N); d[0] = 0; queue Q; Q.push(0); while (!Q.empty()){ int v = Q.front(); Q.pop(); bfs.push_back(v); for (int w : c[v]){ d[w] = d[v] + 1; Q.push(w); } } reverse(bfs.begin(), bfs.end()); vector> dp(N); for (int v : bfs){ if (v != 0){ dp[v] = vector(d[v], 0); int cnt = c[v].size(); vector P(cnt); for (int i = 0; i < cnt; i++){ P[i] = dp[c[v][i]][d[v]]; } for (int i = d[v] - 1; i >= 0; i--){ for (int j = 0; j < cnt; j++){ P[j] += dp[c[v][j]][i]; P[j] %= MOD; } dp[v][i] = 1; for (int j = 0; j < cnt; j++){ dp[v][i] *= P[j]; dp[v][i] %= MOD; } } } } long long ans = 1; for (int v : c[0]){ ans *= dp[v][0]; ans %= MOD; } cout << ans << endl; }