#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long n, second, e, a[N], cnt[60];
vector<long long> vec(N, -1), rest;
int main() {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (ceil(log2(a[i])) == floor(log2(a[i])))
      cnt[(long long)log2(a[i])]++;
    else
      rest.push_back(a[i]);
  }
  long long sz = 0, first;
  for (int i = 0; i < 60; i++) {
    int j = 0;
    while (cnt[i]) {
      if (vec[j] < i - 1) break;
      vec[j] = i, cnt[i]--, j++;
    }
  }
  for (long long i = 0; i < 60; i++)
    while (cnt[i]--) rest.push_back((1LL << i));
  sz = vec.size() - count(vec.begin(), vec.end(), -1);
  if (sz < rest.size()) return cout << -1 << endl, 0;
  sort(rest.rbegin(), rest.rend());
  for (long long k = 0; k < rest.size(); k++)
    if (rest[k] > (1LL << vec[k] + 1)) return cout << -1 << endl, 0;
  e = second = sz, sz -= rest.size();
  int i = 1e5 + 5;
  while (i--) {
    if (vec[i] == -1) continue;
    if (vec[i] + 1 < sz) sz -= (vec[i] + 2), second--;
  }
  for (; second <= e; second++) cout << second << " ";
  cout << endl;
}
