POSTTREE - Editorial

can anyone please explain a little bit how counts array is built?

i have implemented without this with the help of binary search ! but want to know this !

https://www.codechef.com/viewsolution/17201285
My solution using simple DP and dfs. I basically created two arrays, one storing all forward node information and the other one storing all backward node info.