#include <bits/stdc++.h>
using namespace std;
int n, cnt[42];
vector<long long> p;
int Log2(long long x) { return 63 - __builtin_clzll(x); }
bool Check(int k) {
  int adv = k;
  vector<long long> a, b(p.begin(), p.end());
  for (int i = 0; i < 42; ++i) {
    while (adv > cnt[i]) --adv, a.push_back(1LL << i);
    for (int j = adv; j < cnt[i]; ++j) b.push_back(1LL << i);
  }
  if (b.size() > a.size()) return false;
  sort(a.begin(), a.end(), greater<long long>());
  sort(b.begin(), b.end(), greater<long long>());
  for (size_t i = 0; i < b.size(); ++i)
    if (a[i] < b[i]) return false;
  return true;
}
void Solve() {
  int lo = 1, hi = cnt[0], re = -1;
  while (lo <= hi) {
    int mid = (lo + hi) / 2;
    if (Check(mid))
      re = mid, hi = mid - 1;
    else
      lo = mid + 1;
  }
  if (re == -1)
    printf("-1");
  else
    for (; re <= cnt[0]; ++re) printf("%d ", re);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    long long x;
    scanf("%lld", &x);
    if (__builtin_popcountll(x) == 1)
      ++cnt[Log2(x)];
    else
      p.push_back(x);
  }
  Solve();
  return 0;
}
