#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int main() {
  iostream::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long pw = 0, cur = 1;
  vector<long long> ot, cnt(60, 0);
  vector<vector<int> > move;
  for (long long x : a) {
    while (cur < x) {
      cur <<= 1;
      pw++;
    }
    if (cur == x && (!pw || cnt[pw] < cnt[pw - 1]))
      cnt[pw]++;
    else
      ot.push_back(x);
  }
  for (int i = 0; i < 59; i++) {
    for (int j = 0; j < cnt[i] - cnt[i + 1]; j++) {
      move.push_back(vector<int>());
      for (int k = 0; k <= i; k++) move[move.size() - 1].push_back(k);
    }
  }
  for (int i = 0; i < 58; i++) cnt[i] -= cnt[i + 1];
  vector<int> need(60, 0);
  for (long long x : ot) {
    long long pw = 0, cur = 1;
    while (cur <= x) {
      pw++;
      cur <<= 1;
    }
    need[pw - 1]++;
  }
  set<int> ans;
  if (move.empty()) {
    cout << -1;
    return 0;
  }
  int pn = 0, ipn = (int)move[0].size() - 1;
  for (int i = 0; i <= n - ot.size(); i++) {
    while (ipn < 0) {
      pn++;
      if (pn == move.size()) break;
      ipn = (int)move[pn].size() - 1;
    }
    bool ch = 1;
    int fr = 0;
    for (int j = 59; j >= 0; j--) {
      fr += cnt[j];
      if (fr < need[j]) ch = 0;
      fr -= need[j];
    }
    if (ch && i + ot.size() <= move.size() - pn) ans.insert(move.size() - pn);
    if (pn == move.size()) break;
    int x = move[pn][ipn--];
    need[x]++;
    if (x) cnt[x - 1]++;
    cnt[x]--;
  }
  if (!ans.size())
    cout << -1;
  else {
    for (int i : ans) cout << i << ' ';
  }
  return 0;
}
