#include <stdio.h>
#include <stdlib.h>

int main()
{
	int n, *ans, tmp;
	scanf("%d", &n);
	ans = (int*)malloc(sizeof(int) * n);
	for (int i = 0; i < n; i++)
		ans[i] = 0;
	for (int i = 2; i <= n; i++) {
		scanf("%d", &tmp);
		ans[tmp - 1] += ans[i - 1] + 1;
	}

	for (int i = 0; i < n; i++)
		printf("%d\n", ans[i]);

	free(ans);
	return 0;
}