#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000;
const long double INF = 1e18;
vector<long long> v, q, ans;
long long a[maxn], b[maxn], c[maxn], p[maxn];
bool ok(long long r, int k) { return r <= p[k + 1]; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int k = 0;
  long long k2 = 1;
  for (int i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    while (x > k2) {
      k2 *= 2;
      k++;
    }
    if (x == k2) {
      a[k]++;
    } else {
      v.push_back(x);
    }
  }
  p[0] = 1;
  for (int i = 1; i < k + 10; ++i) {
    p[i] = p[i - 1] * 2;
  }
  b[0] = a[0];
  for (int i = 1; i <= k; ++i) {
    b[i] = min(a[i], b[i - 1]);
    long long x = p[i];
    for (int j = 0; j < a[i] - b[i]; ++j) {
      v.push_back(x);
    }
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  b[k + 1] = 0;
  for (int i = k; i >= 0; --i) {
    c[i] = b[i] - b[i + 1];
  }
  for (int i = k; i >= 0; --i) {
    for (int j = 0; j < c[i]; ++j) {
      q.push_back(i);
    }
  }
  if (q.size() < v.size()) {
    cout << "-1\n";
    return 0;
  }
  for (int i = 0; i < (int)v.size(); ++i) {
    if (!ok(v[i], q[i])) {
      cout << "-1\n";
      return 0;
    }
  }
  int m = v.size();
  ans.push_back(q.size());
  long long cur = 0;
  for (int i = q.size() - 1; i > m; --i) {
    cur += q[i] + 1;
    if (i - m >= cur) {
      ans.push_back(i);
    }
  }
  reverse(ans.begin(), ans.end());
  for (int i = 0; i < (int)ans.size(); ++i) {
    cout << ans[i] << ' ';
  }
  return 0;
}
