#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
#define pi pair<ll,ll>
using namespace std;
const int max_n = 1e5 + 3 ;
vector<int>adj[max_n] ;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    int n ;
    cin>> n;
    adj[1].pb(1) ;
    for(int i =2;i <= n; ++i){
		int x ;
		cin>> x ;
		adj[i].pb(x) ;
		adj[x].pb(i) ;
	}
	for(int i =1 ;i <=  n; ++i){
		
		cout<< adj[i].size() - 1<<endl;
    
    
    
}
    
    
    
    
}
