#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 17;
int cnt[maxn], inRange[maxn];
int tempCnt[maxn];
long long a[maxn];
bool check(int length, int n) {
  memset(tempCnt, 0, sizeof tempCnt);
  for (int i = 0; i <= 50; ++i) tempCnt[i] = inRange[i];
  int temp = length;
  vector<pair<int, int> > cntArray;
  for (int i = 0; i <= 50; ++i) {
    if (cnt[i] == 0) {
      cntArray.push_back({i - 1, temp});
      break;
    }
    if (temp > cnt[i]) {
      cntArray.push_back({i - 1, temp - cnt[i]});
      temp = cnt[i];
      tempCnt[i] -= cnt[i];
    } else
      tempCnt[i] -= temp;
  }
  for (int i = cntArray.size() - 1; i >= 0; --i) {
    int id = cntArray[i].first;
    int sz = cntArray[i].second;
    tempCnt[id] -= sz;
  }
  for (int i = 50; i >= 0; --i) tempCnt[i] += tempCnt[i + 1];
  for (int i = 50; i >= 0; --i)
    if (tempCnt[i] > 0) return false;
  return true;
}
int findMin(int n) {
  int l = 1, m, r = cnt[0], ans = -1;
  while (l <= r) {
    m = (l + r) >> 1;
    if (check(m, n))
      r = m - 1, ans = m;
    else
      l = m + 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    int lg2 = log2(a[i]);
    if (1ll << lg2 == a[i]) cnt[lg2]++;
    inRange[lg2]++;
  }
  int minnpos = findMin(n);
  if (minnpos == -1)
    cout << -1;
  else
    for (int i = minnpos; i <= cnt[0]; ++i) cout << i << " ";
}
