#include <bits/stdc++.h>
#pragma GCC optimize("O3")
std::pair<int, int> DR[] = {{-1, 0}, {0, 1},   {1, 0}, {0, -1},
                            {-1, 1}, {-1, -1}, {1, 1}, {1, -1}};
using namespace std;
vector<int> vec[1 << 17];
int s[1 << 17], a[1 << 17];
int x, n;
void dfs(int nod, int par) {
  if ((int)((vec[nod]).size()) == 1 && nod != 1) s[nod] = 1;
  for (auto it : vec[nod]) {
    if (it != par) {
      dfs(it, nod);
      s[nod] += s[it];
    }
  }
  a[s[nod]]++;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cerr.tie(0);
  cout.tie(0);
  cin >> n;
  if (n == 1) return cout << 1, 0;
  for (int i = 2; i <= n; i++) {
    cin >> x;
    vec[i].push_back(x);
    vec[x].push_back(i);
  }
  dfs(1, 0);
  int sum = 0;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    while (i > sum) {
      cnt++;
      sum += a[cnt];
    }
    cout << cnt << ' ';
  }
}
