#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
const int N = 1e6 + 10;
const int maxn = 100020;
const long long mod = 1e9 + 7;
long long a[maxn];
pair<int, int> cnt[50], cur[50];
int n, tot[50];
int num(long long x) {
  int res = 0;
  while ((1ll << (res + 1)) <= x) res++;
  return res;
}
bool check(int mid) {
  memcpy(cur, cnt, sizeof(cur));
  for (register int i = 40; i >= 0; i--) {
    int delta = mid;
    for (register int j = i; j >= 0; j--) delta = min(delta, cur[j].first);
    for (register int j = i; j >= 0; j--) cur[j].first -= delta;
    tot[i] = delta;
    mid -= delta;
  }
  int last = 0;
  for (register int i = 40; i >= 0; i--) {
    last += tot[i] - cur[i].first - cur[i].second;
    if (last < 0) return 0;
  }
  return last >= 0;
}
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    if (a[i] == (1ll << num(a[i])))
      cnt[num(a[i])].first++;
    else
      cnt[num(a[i])].second++;
  }
  int l = 1, r = cnt[0].first, res = -1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      res = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  if (~res) {
    for (register int i = res; i <= cnt[0].first; i++) printf("%d ", i);
  } else {
    puts("-1");
  }
}
