#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const ll INF=1LL<<60; typedef pair P; typedef pair PP; const ll MOD=998244353; int main(){ int N; cin>>N; vector> G(N); vector p(N); for(int i=1;i>p[i]; p[i]--; //G[i].push_back(p[i]); G[p[i]].push_back(i); } vector depth(N,0); auto dfs=[&](auto f,int now,int d)->void{ depth[now]=d; for(int to:G[now]){ f(f,to,d+1); } }; dfs(dfs,0,0); ll ans=1; for(int i=0;i