#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
long long a[maxn];
int cnt[55];
int ans[55];
long long deg[50];
vector<long long> nonpow;
bool check(long long x) {
  if (x == 1) {
    return true;
  }
  if (x % 2) return false;
  return check(x / 2);
}
int get_pow(long long x) {
  int i = -1;
  while (x) {
    i++;
    x /= 2;
  }
  return i;
}
void precalc() {
  deg[0] = 1;
  for (int i = 1; i < 50; i++) {
    deg[i] = deg[i - 1] * 2;
  }
}
void merge(vector<long long> &a, vector<long long> &b, vector<long long> &c) {
  int i = 0, j = 0;
  while (i < a.size() && j < b.size()) {
    if (a[i] < b[j]) {
      c.push_back(a[i]);
      i++;
    } else {
      c.push_back(b[j]);
      j++;
    }
  }
  while (i < a.size()) {
    c.push_back(a[i]);
    i++;
  }
  while (j < b.size()) {
    c.push_back(b[j]);
    j++;
  }
}
int main() {
  precalc();
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (!check(a[i]))
      nonpow.push_back(a[i]);
    else
      cnt[get_pow(a[i])]++;
  }
  int l = 0, r = cnt[0] + 1;
  while (r - l > 1) {
    int mid = (l + r) / 2;
    for (int i = 0; i < 50; i++) ans[i] = 0;
    ans[0] = mid;
    vector<long long> ppow;
    for (int i = 0; i < cnt[0] - ans[0]; i++) ppow.push_back(1);
    for (int i = 1; i < 50; i++) {
      ans[i] = min(ans[i - 1], cnt[i]);
      ans[i - 1] -= ans[i];
      for (int j = 0; j < cnt[i] - ans[i]; j++) ppow.push_back(deg[i]);
    }
    vector<long long> tale;
    merge(ppow, nonpow, tale);
    int cur = 50;
    while (!tale.empty() && cur >= 0) {
      while (cur > 0 && ans[cur] == 0) cur--;
      if (ans[cur] == 0) break;
      while (!tale.empty() && ans[cur] > 0 && tale.back() <= deg[cur + 1]) {
        tale.pop_back();
        ans[cur]--;
      }
      if (!tale.empty() && ans[cur] > 0) break;
    }
    if (tale.empty())
      r = mid;
    else
      l = mid;
  }
  if (r == cnt[0] + 1)
    cout << -1;
  else
    for (int i = r; i <= cnt[0]; i++) cout << i << ' ';
  return 0;
}
