#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
signed main() {
  ios::sync_with_stdio(false);
  cout.precision(17);
  int n;
  cin >> n;
  vector<int> p(n + 1), c(n, 0);
  if (n == 1) {
    cout << "1\n";
    return 0;
  }
  p[1] = 0;
  for (int i = 0; i < (n - 1); i++) {
    cin >> p[i + 2];
  }
  for (int i = n; i > 1; i--) {
    if (!c[i - 1]) c[i - 1] = 1;
    c[p[i] - 1] += c[i - 1];
  }
  sort(c.begin(), c.end());
  for (int i = 0; i < (n); i++) cout << c[i] << " ";
  cout << endl;
  ;
  return 0;
}
