#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using pii = pair<int, int>;
using mii = map<int, int>;
const ll maxn = 100005;
vector<int> adj[maxn];
mii child, visited, fuck;
int dfs(int u) {
  visited[u] = 1;
  int c = 0;
  for (auto v : adj[u])
    if (visited[v] == 0) c += dfs(v);
  if (c == 0) {
    child[u] = 1;
    return 1;
  }
  return child[u] = c;
}
int main() {
  int n, x;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> x;
    adj[i].push_back(x);
    adj[x].push_back(i);
  }
  dfs(1);
  for (int i = 1; i <= n; i++) fuck[child[i]]++;
  int p = 2, ans = 0, last = fuck[1];
  for (int i = 1; i <= n; i++) {
    if (i <= last)
      cout << ans + 1 << " ";
    else {
      while (last <= i) {
        while (fuck[p] == 0) p++;
        ans += (p - 1 - ans);
        fuck[p]--;
        last += 1;
        if (last <= i) break;
      }
      cout << ans + 1 << " ";
    }
  }
  return 0;
}
