#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
const long long M = 1e18 + 7;
const long long MOD = 1e9 + 7;
const int MX = 2e5 + 5;
vector<int> adj[MX];
vector<int> vis(MX);
vector<int> leaf(MX);
int dfs(int u) {
  if (adj[u].size() == 0) {
    leaf[u] = 1;
  }
  for (auto x : adj[u]) {
    leaf[u] += dfs(x);
  }
  return leaf[u];
}
void solve() {
  int n;
  cin >> n;
  for (long long i = 1; i < (n + 1); ++i) {
    adj[i].clear();
  }
  for (long long i = 2; i < (n + 1); ++i) {
    int x;
    cin >> x;
    adj[x].push_back(i);
  }
  for (long long i = 1; i < (n + 1); ++i) {
    leaf[i] = 0;
  }
  dfs(1);
  vector<int> freq(n + 1, 0);
  for (long long j = 1; j < (n + 1); ++j) {
    freq[leaf[j]]++;
  }
  for (long long i = 1; i < (n + 1); ++i) {
    for (long long j = 1; j < (freq[i] + 1); ++j) {
      cout << i << " ";
    }
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
