#include <bits/stdc++.h>
using namespace std;
const int M = 45;
int cnt[M];
int lcnt[M];
int sc[M];
int n;
int main() {
  cin >> n;
  vector<long long> a(n);
  int nums = 0;
  int k = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    while (a[i] > (1LL << k)) k++;
    if (a[i] == (1LL << k))
      cnt[k]++;
    else
      lcnt[k - 1]++;
  }
  for (int i = 1; i < M; ++i) {
    if (cnt[i] > cnt[i - 1]) {
      lcnt[i] += cnt[i] - cnt[i - 1];
      cnt[i] = cnt[i - 1];
    }
  }
  int ltot = 0, tot = 0;
  for (int i = M - 1; i >= 0; --i) {
    sc[i] = max(0, cnt[i] - tot);
    ltot += lcnt[i];
    tot += sc[i];
    if (ltot > tot || sc[i] < 0) {
      cout << -1;
      return 0;
    }
  }
  vector<int> res;
  for (int i = 1; i <= cnt[0]; ++i) {
    int left = 0, k = M - 1, has = 0;
    int used = 0, c_more = 0;
    while (has < i) {
      has += sc[k];
      used += (k + 1) * sc[k];
      if (has >= i) {
        used -= (has - i) * (k + 1);
        break;
      }
      k--;
    }
    if (has < i) continue;
    if (n - used > i) continue;
    res.push_back(i);
  }
  if (res.size() == 0) {
    cout << -1;
    return 0;
  }
  cout << res[0];
  for (int i = 1; i < (int)res.size(); ++i) {
    cout << ' ' << res[i];
  }
  return 0;
}
