#include <bits/stdc++.h>
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
const int maxn = 1e5 + 100;
int sz[maxn];
std::vector<int> c[maxn];
void dfs(int x) {
  for (auto y : c[x]) {
    dfs(y);
    sz[x] += sz[y];
  }
  if (sz[x] == 0) sz[x] = 1;
}
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  std::cin >> n;
  for (int i = 2; i <= n; i++) {
    int p;
    std::cin >> p;
    c[p].push_back(i);
  }
  dfs(1);
  std::vector<int> v;
  for (int i = 1; i <= n; i++) v.push_back(i);
  std::sort(v.begin(), v.end(), [](int x, int y) { return sz[x] < sz[y]; });
  for (int i = 1; i <= n; i++) std::cout << sz[v[i - 1]] << " ";
  std::cout << std::endl;
  return 0;
}
