#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
bool prime[1000001];
long long spf[10000001];
long long f[300005];
long long pow1(long long x, long long y) {
  long long res = 1;
  x = x % mod;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
long long divide(long long n) { return pow1(n, mod - 2); }
long long ncr(long long n, long long r) {
  if (n < r) return 0;
  return (f[n] * ((divide(f[r]) * divide(f[n - r])) % mod)) % mod;
}
void sieve() {
  memset(prime, true, sizeof(prime));
  for (long long i = 2; i * i <= 1000000; i++)
    if (prime[i])
      for (long long j = i * i; j <= 1000000; j += i) prime[j] = false;
  prime[0] = prime[1] = false;
}
void fastsieve() {
  spf[1] = 1;
  for (int i = 2; i <= 1e7; i++) spf[i] = i;
  for (int i = 4; i <= 1e7; i += 2) spf[i] = 2;
  for (int i = 3; i * i <= 1e7; i++) {
    if (spf[i] == i) {
      for (int j = i * i; j <= 1e7; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
vector<long long> factorize(long long n) {
  long long count = 0;
  vector<long long> fac;
  while (!(n % 2)) {
    n >>= 1;
    count++;
  }
  if (count % 2) fac.push_back(2ll);
  for (long long i = 3; i <= sqrt(n); i += 2) {
    count = 0;
    while (n % i == 0) {
      count++;
      n = n / i;
    }
    if (count % 2) fac.push_back(i);
  }
  if (n > 2) fac.push_back(n);
  return fac;
}
vector<long long> fastfactorize(long long n) {
  vector<long long> v;
  long long prev = 0, cnt = 0;
  while (n != 1) {
    if (prev == spf[n])
      cnt++;
    else {
      if (cnt % 2) v.push_back(prev);
      cnt = 1;
      prev = spf[n];
    }
    n /= spf[n];
    if (n == 1) {
      if (cnt % 2) v.push_back(prev);
      cnt = 1;
      prev = spf[n];
    }
  }
  return v;
}
vector<long long> adj[100005];
long long cnt[100005], pa[100005], arr[100005];
void dfs(long long u, long long p) {
  if (adj[u].size() == 1 && u != 1) {
    arr[u] = 1;
    return;
  }
  for (long long x : adj[u]) {
    if (x == p) continue;
    dfs(x, u);
    arr[u] += arr[x];
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, i, j;
  cin >> n;
  for (i = 2; i <= n; i++) {
    long long x;
    cin >> x;
    adj[i].push_back(x);
    adj[x].push_back(i);
    pa[i] = x;
  }
  if (n == 1) {
    cout << 1;
    return 0;
  }
  dfs(1ll, 0ll);
  for (i = 1; i <= n; i++) cnt[arr[i]]++;
  for (i = 0; i <= n; i++) {
    for (j = 1; j <= cnt[i]; j++) cout << i << " ";
  }
  return 0;
}
