def c_management():

    N = int(eval(input()))

    A = [int(i) for i in input().split()]



    tree = [[] for _ in range(N)]

    for k, a in enumerate(A, 2):

        tree[a - 1].append(k - 1)



    ans = [len(t) for t in tree]

    return '\n'.join(map(str, ans))



print((c_management()))
def c_management():

    from collections import Counter

    N = int(eval(input()))

    A = [int(i) for i in input().split()]



    count = Counter(A)

    ans = [count[i] for i in range(1, N + 1)]

    return ' '.join(map(str, ans))



print((c_management()))
def c_management():
    N = int(eval(input()))
    A = [int(i) for i in input().split()]
    tree = [[] for _ in range(N)]
    for k, a in enumerate(A, 2):
        tree[a - 1].append(k - 1)
    ans = [len(t) for t in tree]
    return "\n".join(map(str, ans))


print((c_management()))

def c_management():
    from collections import Counter

    N = int(eval(input()))
    A = [int(i) for i in input().split()]
    count = Counter(A)
    ans = [count[i] for i in range(1, N + 1)]
    return " ".join(map(str, ans))


print((c_management()))

+    from collections import Counter + -    tree = [[] for _ in range(N)] -    for k, a in enumerate(A, 2): -        tree[a - 1].append(k - 1) -    ans = [len(t) for t in tree] -    return "\n".join(map(str, ans)) +    count = Counter(A) +    ans = [count[i] for i in range(1, N + 1)] +    return " ".join(map(str, ans))