N = int(eval(input()))

A = list(map(int, input().split()))



d = {}



for i in range(N - 1):

    if A[i] in d:

        d[A[i]].append(i + 2)

    else:

        d[A[i]] = [i + 2]



for i in range(1, N + 1):

    if i in d:

        print((len(d[i])))

    else:

        print((0))

N = int(eval(input()))

A = list(map(int, input().split()))



result = [0] * N

for a in A:

    result[a - 1] += 1

print(('\n'.join(map(str, result))))

N = int(eval(input()))
A = list(map(int, input().split()))
d = {}
for i in range(N - 1):
    if A[i] in d:
        d[A[i]].append(i + 2)
    else:
        d[A[i]] = [i + 2]
for i in range(1, N + 1):
    if i in d:
        print((len(d[i])))
    else:
        print((0))

N = int(eval(input()))
A = list(map(int, input().split()))
result = [0] * N
for a in A:
    result[a - 1] += 1
print(("\n".join(map(str, result))))

-d = {} -for i in range(N - 1): -    if A[i] in d: -        d[A[i]].append(i + 2) -    else: -        d[A[i]] = [i + 2] -for i in range(1, N + 1): -    if i in d: -        print((len(d[i]))) -    else: -        print((0)) +result = [0] * N +for a in A: +    result[a - 1] += 1 +print(("\n".join(map(str, result))))