#include <bits/stdc++.h>
using namespace std;
int sv[44];
int Chains[44];
int minChain[44];
int lft[44];
int a[100005];
int n;
bool test(int num) {
  Chains[0] = num;
  lft[0] = sv[0] - Chains[0];
  for (int i = 1; i < 40; i++) {
    Chains[i] = min(Chains[i - 1], sv[i]);
    Chains[i - 1] -= Chains[i];
    lft[i] = sv[i] - Chains[i];
  }
  int cur = 0;
  for (int i = 39; i >= 0; i--) {
    cur += Chains[i];
    if (lft[i] + minChain[i] > cur) return false;
    cur -= (lft[i] + minChain[i]);
  }
  return true;
}
int main() {
  scanf("%d", &n);
  for (int o = 0; o < n; o++) {
    long long x;
    scanf("%lld", &x);
    int cur = 0;
    long long tmp = x;
    while (x > 1) {
      if (x & 1) break;
      cur++;
      x >>= 1;
    }
    if (x == 1)
      sv[cur]++;
    else {
      cur = 0;
      long long tmp2 = 0;
      for (int i = 0;; i++) {
        tmp2 += (1ll << i);
        if (tmp2 >= tmp) break;
        cur++;
      }
      minChain[cur]++;
    }
  }
  int lo = 1, hi = sv[0] + 1;
  while (lo < hi) {
    int md = lo + (hi - lo) / 2;
    if (test(md))
      hi = md;
    else
      lo = md + 1;
  }
  if (lo > sv[0])
    cout << -1 << '\n';
  else
    for (int i = lo; i <= sv[0]; i++) cout << i << ' ';
  return 0;
}
