#include <bits/stdc++.h>
using namespace std;
int n;
int cnt[60];
int ost[60];
vector<int> ans;
bool check(int m) {
  if (cnt[0] < m) return false;
  int now = m;
  int after[60];
  int newost[60];
  for (int i = 0; i < 60; i++) newost[i] = ost[i];
  for (int i = 0; i < 60; i++) {
    now = min(now, cnt[i]);
    after[i] = now;
    newost[i] += max(0, cnt[i] - now);
  }
  int k = 0;
  for (int i = 59; i >= 0; i--) {
    if (after[i] - k < newost[i]) return false;
    k += newost[i];
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long x;
    long long st = 1;
    int it = 0;
    cin >> x;
    while (st * 2 <= x) {
      st *= 2;
      it++;
    }
    if (x == st)
      cnt[it]++;
    else
      ost[it]++;
  }
  for (int m = 1; m <= n; m++) {
    if (check(m)) ans.push_back(m);
  }
  if (ans.empty())
    cout << -1 << endl;
  else
    for (int i = 0; i < ans.size(); i++) cout << ans[i] << ' ';
}
