Question
Count Direct Subordinates

In a vast empire with N citizens, each person is assigned an ID from 1 to N. Every citizen, except the one with ID 1, has a designated superior with a smaller ID. If person A is the direct superior of person B, then B is called a direct subordinate of A. You are given an array of N integers, where the ith integer represents the ID of the superior for the citizen with ID i. Can you determine the number of direct subordinates each citizen has?

Input
The first line of the input contains a single integer N.
The second line of the input contains N space-separated integers A1, A2, A3,. ... AN. Ai represents that the master of person with ID i is Ai.

Constraints
2 ≤ N ≤ 4x105
1 ≤ Ai​ ≤ N
Output
For each person from 1 to N, print the number of immediate slaves they have in a new line.
Example
Sample Input
5
1 1 1 2 3
Sample Output
2
1
1
0
0
Explanation
According to the input,
   1) No master for Person 1
   2) Master of Person 2 is Person 1
   3) Master of Person 3 is Person 1
   4) Master of Person 4 is Person 2
   5) Master of Person 5 is Person 3
So, the total intermediate slaves for each person are:
   1) Slaves of Person 1 are 2
   2) Slaves of Person 2 are 1
   3) Slaves of Person 3 are 1
   4) Slaves of Person 4 are 0
   5) Slaves of Person 5 are 0

Online