#include <bits/stdc++.h>
using namespace std;
int power(int i, int j) {
  if (j == 0) return 1;
  int t = power(i, j / 2) % 1000000;
  if (j % 2 == 0)
    return (t % 1000000 * t % 1000000) % 1000000;
  else
    return ((t % 1000000 * t % 1000000) % 1000000 * (i % 1000000) % 1000000) %
           1000000;
}
bool is(int i) {
  if (i == 1) return 0;
  int f = 0;
  for (int j = 2; j <= sqrt(i); j++) {
    if (i % j == 0) {
      f = 1;
      break;
    }
  }
  return !f;
}
void askquery(int i, int j) { cout << "? " << i << " " << j << '\n' << flush; }
long long n;
vector<long long> v[100001];
long long lol[100001];
void dfs(long long i, long long p) {
  long long ans = 0;
  for (long long j : v[i]) {
    if (j == p) continue;
    dfs(j, i);
    ans += lol[j];
  }
  if (ans == 0)
    lol[i] = 1;
  else
    lol[i] = ans;
}
int main() {
  cin >> n;
  for (long long i = 2; i < n + 1; i++) {
    long long x;
    cin >> x;
    v[i].push_back(x);
    v[x].push_back(i);
  }
  memset(lol, 0, sizeof(lol));
  dfs(1, -1);
  vector<long long> vv(n + 1, 0);
  for (long long i = 1; i < n + 1; i++) {
    vv[lol[i]]++;
  }
  for (long long i = 1; i < n + 1; i++) {
    vv[i] += vv[i - 1];
  }
  for (long long i = 1; i < n + 1; i++) {
    long long x =
        (long long)(lower_bound(vv.begin(), vv.end(), i) - vv.begin());
    cout << x << " ";
  }
}
