#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n;
long long a[maxn];
int cnt_a[maxn], cnt_b[maxn], maxp;
bool check(int x) {
  int res = cnt_a[0] - x;
  if (res < 0) return false;
  for (int i = 1; i <= maxp + 1; i++) {
    if (cnt_a[i] >= x) {
      if (x == 0) return false;
      res += cnt_a[i] - x;
      res += cnt_b[i];
    } else {
      if (cnt_a[i] + cnt_b[i] < x)
        res = max(0, res - x + cnt_a[i] + cnt_b[i]);
      else
        res += cnt_a[i] + cnt_b[i] - x;
      x = cnt_a[i];
    }
  }
  return true && !res;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    int p = 0;
    bool flag = true;
    while (a[i] > 1) {
      if (a[i] & 1) flag = false;
      p++;
      a[i] >>= 1;
    }
    maxp = max(maxp, p);
    if (flag)
      cnt_a[p]++;
    else
      cnt_b[p + 1]++;
  }
  int ans = -1;
  for (int i = 1; i <= n; i++) {
    if (check(i)) {
      ans = i;
      break;
    }
  }
  if (ans == -1)
    printf("-1\n");
  else
    for (int i = ans; i <= cnt_a[0]; i++)
      printf("%d%c", i, i == cnt_a[0] ? '\n' : ' ');
  return 0;
}
