Problems
Subordinates
Subordinates
Given the structure of a company, your task is to calculate for each employee the number of their subordinates.
\InputFile
The first line has an integer $n\:(1 \le n \le 2 \cdot 10^5)$ --- the number of employees. The employees are numbered $1$, $2$, ..., $n$, and employee $1$ is the general director of the company.
After this, there are $n − 1$ integers: for each employee $2$, $3$, ... , $n$ their direct boss in the company.
\OutputFile
Print $n$ integers: for each employee $1$, $2$, ..., $n$ the number of their subordinates.
\includegraphics{https://static.eolymp.com/content/mn/mncnvh5u2p00f6kkksked7lhj8.gif}
Input example #1
5 1 1 2 3
Output example #1
4 1 1 0 0