#include <bits/stdc++.h>
using namespace std;
template <typename X>
inline bool minimize(X& p, X q) {
  if (p <= q) return 0;
  p = q;
  return 1;
}
template <typename X>
inline bool maximize(X& p, X q) {
  if (p >= q) return 0;
  p = q;
  return 1;
}
const long long inf = 10000000000000;
struct node {
  int x, y;
  bool operator<(const node& oth) const { return x < oth.x; }
};
vector<int> aa, bb;
const int mod = 1000000007;
long long e[60];
int t1[60], t2[60];
long long a[100005];
int n, ma, o;
bool ok(int x) {
  int can = x, cann, last = 0;
  for (int i = 1; i <= ma; i++) {
    cann = can;
    if (t1[i] <= can) {
      last -= min(can - t1[i], last);
      can = t1[i];
    } else if (t1[i] > 2 * can - last)
      return 0;
    last += max(t1[i] - cann, 0) + t2[i + 1];
    if (can < last) return 0;
  }
  return 1;
}
void doit() {
  scanf("%d", &n);
  int o = 1;
  e[1] = 1;
  memset(t1, 0, sizeof(t1));
  memset(t2, 0, sizeof(t2));
  while (e[o] < inf) {
    o++;
    e[o] = e[o - 1] * 2;
  }
  int j = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    while (a[i] > e[j]) j++;
    if (a[i] == e[j])
      t1[j]++;
    else if (a[i] < e[j + 1])
      t2[j]++;
  }
  ma = j;
  int yy = 0;
  for (int i = 1; i <= t1[1]; i++)
    if (ok(i)) {
      printf("%d ", i);
      yy++;
    }
  if (!yy) printf("%d\n", -1);
}
int main() { doit(); }
