#include <bits/stdc++.h>
using namespace std;
long long lv[100001], lf[100001], par[100001], n;
vector<long long> con[100001], cld[100001];
long long get_leaf(long long id) {
  if (cld[id].size() == 0) {
    lf[1]++;
    return 1;
  }
  long long x = 0, i;
  for (i = 0; i <= cld[id].size() - 1; i++) {
    x += get_leaf(cld[id][i]);
  }
  lf[x]++;
  return x;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long int i, j, x, y, m, cnt = 0, k, g, flg, t, l, r, md;
  cin >> n;
  for (i = 2; i <= n; i++) {
    cin >> x;
    con[x].push_back(i);
    con[i].push_back(x);
  }
  queue<long long> q;
  q.push(1);
  while (!q.empty()) {
    x = q.front();
    q.pop();
    if (con[x].size() == 0) continue;
    for (i = 0; i <= con[x].size() - 1; i++) {
      y = con[x][i];
      if (par[y] || y == 1) continue;
      par[y] = x;
      cld[x].push_back(y);
      q.push(y);
    }
  }
  x = get_leaf(1);
  for (i = 2; i <= n; i++) {
    lf[i] += lf[i - 1];
  }
  for (i = 1; i <= n; i++) {
    l = 0;
    r = n;
    while (r - l > 1) {
      md = (l + r) / 2;
      if (lf[md] < i)
        l = md;
      else
        r = md;
    }
    cout << r << " ";
  }
}
