can you explain deeply this solution ??
Beautiful Vertices problem Solution
its says that if there is a connected component then the master parent is smallest number.
that means now you can imagine a graph which is hanged from the vertex with the smallest value.
now you can easily see who is the parent of each vertex .
now for every node mark its children and at last count number of (child,parent) pair whose child has more children than its parent.