#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> cnt(100);
  vector<int> cnt1(100);
  int maxe = 0;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    int e = 0;
    long long p2 = 1;
    while (p2 < x) {
      p2 *= 2LL;
      e++;
    }
    maxe = max(maxe, e);
    if (p2 == x) {
      cnt[e]++;
    } else {
      cnt1[e]++;
    }
  }
  vector<int> ans;
  for (int c = 1; c <= cnt[0]; c++) {
    int cc = c;
    int nu = cnt[0] - c;
    bool ok = true;
    for (int i = 1; i <= maxe; i++) {
      nu += cnt1[i];
      if (cnt[i] >= cc) {
        nu += cnt[i] - cc;
      } else if (nu < cc - cnt[i]) {
        nu = 0;
        cc = cnt[i];
      } else {
        nu -= (cc - cnt[i]);
        cc = cnt[i];
      }
    }
    if (nu > cc) {
      ok = false;
    }
    if (ok) {
      ans.push_back(c);
    }
  }
  if (!ans.size()) {
    cout << "-1\n";
    return 0;
  }
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i];
    if (i + 1 < ans.size()) {
      cout << " ";
    }
  }
  cout << "\n";
}
