#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define LL       long long
#define PR       pair<LL, LL>
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

const int N = 3e5 + 5;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

LL sub[N], vis[N];
vector<int> g[N];

void dfs(int u) {
    vis[u] = 1;
    LL cnt = 0;
    for (auto v : g[u]) {
        if (!vis[v]) {
            dfs(v);
            cnt += sub[v];
            cnt++;
        }
    }
    sub[u] = cnt;
}

int main() {
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 2; i <= n; i++) {
        int u;
        cin >> u;
        g[u].push_back(i);
    }
//    for (int i = 1; i <= n; i++) {
//        if (!vis[i]) {
//            dfs(1);
//        }
//    }
    for (int i = 1; i <= n; i++) {
        cout << (int)g[i].size() << '\n';
    }
    return 0;
}
