#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
using bigint = long long int;
using vi = vector<int>;
using vll = vector<long long int>;
vi adj[100005];
map<int, int> m;
int dfs(int v, int par) {
  if (adj[v].size() == 1 && par != -1) {
    m[1]++;
    return 1;
  }
  int sum = 0;
  for (int u : adj[v]) {
    if (u != par) sum += dfs(u, v);
  }
  m[sum]++;
  return sum;
}
int main() {
  int N;
  cin >> N;
  for (int i = 2; i <= N; i++) {
    int x;
    cin >> x;
    adj[x].push_back(i);
    adj[i].push_back(x);
  }
  dfs(1, -1);
  if (N == 1) {
    cout << "1"
         << "\n";
    return 0;
  }
  int ans[N + 2];
  memset(ans, -1, sizeof(ans));
  int prev = 0;
  for (auto x : m) {
    prev += x.second;
    ans[prev] = x.first;
  }
  for (int i = N; i >= 1; i--) {
    if (ans[i] != -1) continue;
    ans[i] = ans[i + 1];
  }
  for (int i = 1; i <= N; i++) cout << ans[i] << " ";
  cout << "\n";
  return 0;
}
