#include <bits/stdc++.h>
using namespace std;
const int LOG = 40, MAX_N = 1e5 + 100;
int cnt[LOG + 10], cnt_bad[LOG + 10], cur[LOG + 10], cnt_bad0[LOG + 10];
long long A[MAX_N];
inline int two(long long a) {
  int k = 0;
  while (!(a & 1)) a >>= 1, ++k;
  if (a > 1)
    return -1;
  else
    return k;
}
inline int two_lower(long long a) {
  long long x = 1;
  int k = 0;
  while (x * 2 <= a) x *= 2, ++k;
  return k;
}
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < (N); ++i) {
    scanf("%lld", &A[i]);
    int k = two(A[i]);
    if (k == -1)
      ++cnt_bad[two_lower(A[i])];
    else
      ++cnt[k];
  }
  for (int i = 0; i < (LOG); ++i) cnt_bad0[i] = cnt_bad[i];
  vector<int> v;
  for (int ans = 1; ans <= cnt[0]; ++ans) {
    bool ok = 1;
    cur[0] = ans;
    int left = cnt[0] - ans;
    cnt_bad[0] += left;
    for (int i = 1; i < LOG; ++i) {
      int x = min(cnt[i], cur[i - 1]);
      cur[i] = x, cur[i - 1] -= x;
      cnt_bad[i] += cnt[i] - x;
    }
    if (ok) {
      int need = 0;
      for (int i = 0; i < (LOG); ++i) {
        need += cnt_bad[i];
        need -= min(cur[i], need);
      }
      if (need > 0) ok = 0;
    }
    if (ok) v.push_back(ans);
    for (int i = 0; i < (LOG); ++i) cnt_bad[i] = cnt_bad0[i];
  }
  if (v.empty()) {
    puts("-1");
  } else {
    for (int x : v) printf("%d ", x);
    puts("");
  }
  return 0;
}
