#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> cnt(50);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    for (long long j = 0; j < 50; j++) {
      if (((1LL << j) & a[i]) == a[i]) {
        cnt[j]++;
      }
    }
  }
  vector<long long> mass;
  while (cnt[0] > 0) {
    long long c = 1;
    for (long long j = 0; j < 50; j++) {
      if (cnt[j] > 0) {
        c *= 2;
        cnt[j]--;
      } else {
        break;
      }
    }
    mass.push_back(c);
  }
  vector<long long> mass1;
  for (long long i = 0; i < n; i++) {
    bool flag = 0;
    long long p = -1;
    for (long long j = 0; j < 50; j++) {
      if (((1LL << j) & a[i]) == a[i]) {
        p = j;
        flag = 1;
      }
    }
    if (p != -1) {
      if (cnt[p] > 0) {
        mass1.push_back(a[i]);
        cnt[p]--;
      }
    } else {
      mass1.push_back(a[i]);
    }
  }
  if ((long long)mass1.size() > (long long)mass.size()) {
    cout << -1;
    return 0;
  }
  vector<long long> post(mass.size() + 1);
  for (long long i = mass.size() - 1; i >= 0; i--) {
    long long c = 1;
    long long j = 0;
    while (mass[i] > c) {
      j++;
      c *= 2;
    }
    post[i] = post[i + 1] + j;
  }
  reverse(mass1.begin(), mass1.end());
  for (long long i = 0; i < mass1.size(); i++) {
    if (mass1[i] >= mass[i]) {
      cout << -1;
      return 0;
    }
  }
  long long r = mass.size();
  long long l = mass.size();
  for (long long i = 0; i < mass.size() - 1; i++) {
    if (post[i + 1] + mass1.size() <= i + 1) {
      l = i + 1;
      break;
    }
  }
  for (long long i = l; i <= r; i++) {
    cout << i << " ";
  }
  return 0;
}
