#include #include #include using namespace std; struct Node { Node(){ count=0; } int i; int parent; vector children; int count; }; void count(vector &nodes,Node &node,list path) { for(int i=0;ii> N; vector nodes(N); nodes[0].i=0; nodes[0].parent=-1; for(int i=1;i> parent; nodes[i].i = i; nodes[i].parent = parent; nodes[parent].children.push_back(i); } list path; count(nodes,nodes[0],path); int ans = 0; for(int i=0;i