#include <bits/stdc++.h>
using namespace std;
int n, s[100005], p[100005];
long long a[100005];
bool check(int x) {
  if (x > s[1]) return 0;
  int now = 0, re = x;
  for (int i = 1; i <= 60; i++) {
    now += p[i];
    if (s[i] >= re)
      now += s[i] - re;
    else {
      int tmp = re - s[i];
      if (now < tmp)
        now = 0;
      else
        now -= tmp;
      re -= tmp;
    }
  }
  return now <= re;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    long long now = 1;
    int x = 1;
    while (a[i] > now) now *= 2, x++;
    if (a[i] == now)
      s[x]++;
    else
      p[x]++;
  }
  int flag = 0;
  for (int i = 1; i <= n; i++) {
    if (check(i)) printf("%d ", i), flag = 1;
  }
  if (!flag) puts("-1");
}
