100 atcoder#ABC163C. [ABC163C] management

[ABC163C] management

Score : 300300 points

Problem Statement

A company has NN members, who are assigned ID numbers 1,...,N1, ..., N.

Every member, except the member numbered 11, has exactly one immediate boss with a smaller ID number.

When a person XX is the immediate boss of a person YY, the person YY is said to be an immediate subordinate of the person XX.

You are given the information that the immediate boss of the member numbered ii is the member numbered AiA_i. For each member, find how many immediate subordinates it has.

Constraints

  • 2N2×1052 \leq N \leq 2 \times 10^5
  • 1Ai<i1 \leq A_i < i

Input

Input is given from Standard Input in the following format:

NN

A2A_2 ...... ANA_N

Output

For each of the members numbered 1,2,...,N1, 2, ..., N, print the number of immediate subordinates it has, in its own line.

5
1 1 2 2
2
2
0
0
0

The member numbered 11 has two immediate subordinates: the members numbered 22 and 33.

The member numbered 22 has two immediate subordinates: the members numbered 44 and 55.

The members numbered 33, 44, and 55 do not have immediate subordinates.

10
1 1 1 1 1 1 1 1 1
9
0
0
0
0
0
0
0
0
0
7
1 2 3 4 5 6
1
1
1
1
1
1
0