#include <bits/stdc++.h>
using namespace std;
void init() {}
const int N = (int)1e6 + 34;
const long long md = (int)1e9 + 7;
int n;
long long a[N], x, d;
int k[N];
int p[N];
long long max_st;
int main() {
  init();
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", a + i);
    x = a[i];
    d = -1;
    while (x > 0) {
      x >>= 1;
      d++;
    }
    if ((1ll << d) == a[i]) {
      if (k[d] == 0) p[d] = i;
      k[d]++;
    }
  }
  max_st = 0;
  while (k[max_st + 1]) max_st++;
  if (a[n - 1] > (2ll << max_st)) {
    printf("-1\n");
    return 0;
  }
  vector<int> ans;
  for (int m = 1; m <= n; m++) {
    int e = 0;
    int fri = m;
    int lst = m;
    if (k[0] < m) continue;
    bool fail = false;
    for (int i = 1; !fail && i <= max_st; i++) {
      fri -= (p[i] - (p[i - 1] + lst));
      lst = min(k[i], lst);
      fri = min(k[i], fri);
      if (fri < 0) fail = true;
    }
    if (!fail && fri >= (n - (p[max_st] + lst))) ans.push_back(m);
  }
  if (ans.empty()) {
    printf("-1");
    return 0;
  }
  for (int i = 0; i < (int)ans.size(); i++) printf("%d ", ans[i]);
  return 0;
}
