#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
struct Sync_stdio {
  Sync_stdio() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
  }
} _sync_stdio;
struct FAIL {
  FAIL() {
    cout << "CHANGE!!!"
         << "\n";
  }
};
bool check(const vector<int> &pows_cnt, vector<int> greater_cnt, int cnt) {
  if (pows_cnt[0] < cnt) {
    return false;
  }
  int maxc = cnt;
  vector<int> numbers_cnt(pows_cnt.size());
  for (int i = (0); i < (pows_cnt.size()); ++i) {
    maxc = min(maxc, pows_cnt[i]);
    numbers_cnt[i] = maxc;
    greater_cnt[i] += pows_cnt[i] - maxc;
  }
  for (int i = (int(numbers_cnt.size()) - 2); i > (-1); --i) {
    greater_cnt[i] += greater_cnt[i + 1];
  }
  for (int i = (0); i < (numbers_cnt.size()); ++i) {
    if (numbers_cnt[i] < greater_cnt[i]) {
      return false;
    }
  }
  return true;
}
int main() {
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int __i = 0; __i < (n); ++__i) cin >> v[__i];
  ;
  vector<int> greater_cnt(50);
  vector<int> pows_cnt(50);
  for (int i = (0); i < (n); ++i) {
    if (v[i] & (v[i] - 1)) {
      ++greater_cnt[63 - __builtin_clzll(v[i])];
    } else {
      ++pows_cnt[63 - __builtin_clzll(v[i])];
    }
  }
  vector<int> res;
  for (int i = (0); i < (n); ++i) {
    if (check(pows_cnt, greater_cnt, i + 1)) {
      res.push_back(i + 1);
    }
  }
  if (res.empty()) {
    cout << -1;
    return 0;
  }
  for (const auto &elem : res) {
    cout << elem << " ";
  }
}
