#include <bits/stdc++.h>
using namespace std;
int n;
int Pow[70], bet[70];
bool check(int k) {
  int R = (Pow[0] - k);
  for (int i = 1; i <= 63; i++) {
    if (k >= Pow[i]) {
      R -= min(R, k - Pow[i]);
      k = Pow[i];
    } else {
      R += (Pow[i] - k);
    }
    R += bet[i];
  }
  return R <= k;
}
int main() {
  scanf("%d", &n);
  memset(bet, 0, sizeof(bet));
  memset(Pow, 0, sizeof(Pow));
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%I64d", &x);
    bool flag = true;
    int cnt = 0;
    while (x != 1) {
      if (x % 2 != 0) {
        flag = false;
      }
      cnt++;
      x /= 2;
    }
    if (flag) {
      Pow[cnt]++;
    } else {
      bet[cnt]++;
    }
  }
  int ans = -1;
  int l = 1;
  int r = Pow[0];
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  if (ans == -1) {
    printf("%d\n", ans);
  } else {
    for (int i = ans; i <= Pow[0]; i++) {
      printf("%d ", i);
    }
  }
  return 0;
}
