#include <bits/stdc++.h>
using namespace std;
long long a[100000 + 10];
int tot1[60], tot2[60];
int n, p;
bool Check(int x) {
  int sum = 0;
  for (int i = 0; i <= p + 1; i++) {
    sum += tot2[i] - x;
    if (sum < 0) sum = 0;
    x = min(x, tot1[i]);
  }
  return sum <= 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    while ((1ll << p) < a[i]) p++;
    tot2[p]++;
    if ((1ll << p) == a[i]) tot1[p]++;
  }
  int l = 1, r = tot1[0], ans = -1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (Check(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  if (ans == -1)
    printf("%d\n", ans);
  else
    for (int i = ans; i <= tot1[0]; i++) printf("%d ", i);
  return 0;
}
