#include <bits/stdc++.h>
using namespace std;
long long n, subtree_size[200002], prefix[200002], ans, x;
long long cnt[200002];
vector<long long> g[200002];
void dfs(long long node) {
  subtree_size[node] = 0;
  if (g[node].size() == 0) {
    subtree_size[node] = 1;
    cnt[1]++;
    return;
  }
  for (auto child : g[node]) {
    dfs(child);
    subtree_size[node] += subtree_size[child];
  }
  cnt[subtree_size[node]]++;
}
int main() {
  scanf("%lld", &n);
  for (long long i = 2; i <= n; i++) {
    scanf("%lld", &x);
    g[x].push_back(i);
  }
  dfs(1);
  for (long long i = 1; i <= n; i++) prefix[i] = prefix[i - 1] + cnt[i];
  for (long long k = 1; k <= n; k++) {
    ans = lower_bound(prefix + 1, prefix + n + 1, k) - prefix;
    printf("%lld ", ans);
  }
  return 0;
}
