#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T& x) {
  int f = 0, c = getchar();
  x = 0;
  while (!isdigit(c)) f |= c == '-', c = getchar();
  while (isdigit(c)) x = x * 10 + c - 48, c = getchar();
  if (f) x = -x;
}
template <typename T, typename... Args>
inline void read(T& x, Args&... args) {
  read(x);
  read(args...);
}
template <typename T>
void write(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + 48);
}
template <typename T>
void writes(T x) {
  write(x);
  putchar(' ');
}
template <typename T>
void writeln(T x) {
  write(x);
  puts("");
}
template <typename T>
inline bool chkmin(T& x, const T& y) {
  return y < x ? (x = y, true) : false;
}
template <typename T>
inline bool chkmax(T& x, const T& y) {
  return x < y ? (x = y, true) : false;
}
const int maxn = (int)3e5 + 10;
const long long inf = (long long)1e18;
const int mod = (int)1e9 + 7;
int n, p[maxn], sum[maxn];
bool in[maxn];
int main() {
  read(n);
  for (int i = (2); i < (n + 1); i++) {
    read(p[i]);
    in[p[i]] = 1;
  }
  for (int i = (n + 1) - 1; i >= (1); i--) {
    if (!in[i]) {
      sum[i] = 1;
    }
    sum[p[i]] += sum[i];
  }
  sort(sum + 1, sum + n + 1);
  for (int i = (1); i < (n + 1); i++) {
    writes(sum[i]);
  }
}
