#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7, INF = 2e9 + 1, mod = 1e9 + 7;
const double PI = 3.141592653589793238462643383279502884197, eps = 1e-6;
vector<int> tree[N];
int cnt[N];
int ans[N];
int dfs(int ind, int p) {
  if ((ind && tree[ind].size() == 1) || !tree[ind].size()) return cnt[ind] = 1;
  int ret = 0;
  for (int i : tree[ind])
    if (i != p) ret += dfs(i, ind);
  return cnt[ind] = ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, x;
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> x;
    x--;
    tree[i].push_back(x);
    tree[x].push_back(i);
  }
  dfs(0, -1);
  sort(cnt, cnt + n);
  for (int i = 1, j = 0; i <= n; i++) {
    ans[i] = ans[i - 1];
    for (; j < n && cnt[j] <= i; j++) ans[i]++;
  }
  for (int i = 1, j = 1; i <= n; i++) {
    while (i > ans[j]) j++;
    cout << j << ' ';
  }
  return 0;
}
