#include <bits/stdc++.h>
using namespace std;
int n;
long long a[100005];
int check(int x) {
  int i, j, res, ress, t, sum;
  long long A, AA;
  i = 0;
  ress = 0;
  for (j = 0; j < 60; j++) {
    A = (1LL << j);
    res = 0;
    for (; i < n; i++) {
      if (a[i] == A) {
        res++;
      } else if (a[i] < A) {
        ress++;
      } else
        break;
    }
    if (ress > x) return 0;
    if (x > res) {
      ress -= (x - res);
      if (ress < 0) ress = 0;
      x = res;
    }
    if (res > x) ress += (res - x);
  }
  return 1;
}
int main(void) {
  int i, j, L, R, M, ans;
  scanf("%d", &n);
  L = 0;
  R = 0;
  for (i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    if (a[i] == 1) R++;
  }
  sort(a, a + n);
  ans = R;
  while (L < R) {
    M = (L + R) / 2;
    if (check(M))
      R = M;
    else
      L = M + 1;
  }
  if (L == 0 || check(L) == 0) {
    printf("-1\n");
    return 0;
  }
  for (i = L; i <= ans; i++) {
    printf("%d ", i);
  }
  printf("\n");
}
