#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int inf = 0x3f3f3f3f;
inline long long read() {
  register long long x = 0, f = 1;
  register char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  return x * f;
}
void write(long long x) {
  if (x < 0) x = -x, putchar('-');
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writeln(long long x) {
  write(x);
  puts("");
}
const int maxn = 1e5 + 233;
long long a[66], b[66];
bool check(long long x) {
  if (x > a[1]) return false;
  int rem = x, now = 0;
  for (int i = 1; i <= 60; ++i) {
    now += b[i];
    if (rem < a[i])
      now += a[i] - rem;
    else if (a[i] < rem) {
      int tmp = rem - a[i];
      if (now <= tmp)
        now = 0;
      else
        now -= tmp;
      rem -= tmp;
    }
  }
  return now <= rem;
}
int main() {
  long long n = read();
  for (register int i = (1); i <= int(n); ++i) {
    long long A = read();
    long long now = 1, x = 1;
    while (A > now) now <<= 1, x++;
    if (A == now)
      a[x]++;
    else
      b[x]++;
  }
  bool flag = false;
  for (register int i = (1); i <= int(n); ++i) {
    if (check(i)) write(i), putchar(' '), flag = true;
  }
  if (!flag) puts("-1");
  return 0;
}
