#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> vec, vec2, vec3;
vector<list<int>> m;
stack<int> st;
int gr(int f) {
  for (int i : m[f]) {
    vec3[f] += gr(i);
  }
  if (vec3[f] == 0)
    return vec3[f] = 1;
  else
    return vec3[f];
}
int main() {
  cin >> n;
  vec = vector<int>(n + 1, 0);
  vec2 = vector<int>(n + 1, 0);
  vec3 = vector<int>(n + 1, 0);
  m = vector<list<int>>(n + 1, list<int>());
  for (int i = 2; i <= n; i++) {
    cin >> vec[i];
    m[vec[i]].push_back(i);
  }
  gr(1);
  sort(vec3.begin(), vec3.end());
  for (int i = 1; i <= n; i++) {
    cout << vec3[i] << " ";
  }
  return 0;
}
