#include <bits/stdc++.h>
using namespace std;
long long a[100010];
int power[100], between[100];
bool judge(int x) {
  int r = 0;
  for (int i = 0; i < 63; i++) {
    if (i > 0) r += between[i - 1];
    if (power[i] > x) {
      r += power[i] - x;
    } else if (power[i] < x) {
      r -= min(r, x - power[i]);
      x = power[i];
    }
  }
  return r <= 0;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  long long now = 1;
  int idx = 0;
  for (int i = 0; i < n; i++) {
    while (a[i] > now) {
      idx++;
      now *= 2;
    }
    if (a[i] == now) {
      power[idx]++;
    }
    if (a[i] < now) {
      between[idx - 1]++;
    }
  }
  int y = power[0] + 1, x = 1;
  while (x < y) {
    int mid = x + (y - x) / 2;
    if (judge(mid))
      y = mid;
    else
      x = mid + 1;
  }
  if (x > power[0]) {
    cout << -1 << endl;
  } else {
    for (int i = x; i <= power[0]; i++) {
      if (i > x) putchar(' ');
      printf("%d", i);
    }
    puts("");
  }
  return 0;
}
