#include <bits/stdc++.h>
using namespace std;
using II = pair<long long, long long>;
using VII = vector<II>;
using VI = vector<long long>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
template <class T = long long>
inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T = long long>
inline bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
ostream &operator<<(ostream &s, const vector<T> &d) {
  long long n = d.size();
  for (long long i = 0, max_i = (n); i < max_i; i++) s << d[i] << " ";
  return s;
}
template <class T>
ostream &operator<<(ostream &s, const vector<vector<T>> &dd) {
  for (vector<T> d : dd) s << d << endl;
  return s;
}
template <class T, class S>
ostream &operator<<(ostream &s, const pair<T, S> &p) {
  s << "{" << p.first << ", " << p.second << "}";
  return s;
}
struct Fast {
  Fast() {
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
const long long MOD = 1e9 + 7;
signed main() {
  long long n;
  cin >> n;
  VVI G(n);
  for (long long i = 0, max_i = (n - 1); i < max_i; i++) {
    long long p;
    cin >> p;
    p--;
    G[i + 1].push_back(p);
    G[p].push_back(i + 1);
  }
  VI num(n + 1);
  function<long long(long long, long long)> dfs = [&](long long v,
                                                      long long p) {
    long long sum = 0;
    for (long long s : G[v])
      if (s != p) {
        sum += dfs(s, v);
      }
    long long ret = max(1LL, sum);
    num[ret]++;
    return ret;
  };
  dfs(0, -1);
  for (long long i = 0, max_i = (n); i < max_i; i++) {
    num[i + 1] += num[i];
  }
  long long ans = 0;
  for (long long i = (1), max_i = (n + 1); i < max_i; i++) {
    while (num[ans] < i) ans++;
    cout << ans << ' ';
  }
  cout << endl;
}
