#include <bits/stdc++.h>
int n, p;
int num[50], s[50];
int a[50], b[50];
bool check(int x) {
  memcpy(a, num, sizeof(num));
  memcpy(b, s, sizeof(s));
  a[0] = a[0] + b[0] - x;
  b[0] = x;
  for (int i = 1; i <= p; i++)
    if (b[i] > b[i - 1]) a[i] += b[i] - b[i - 1], b[i] = b[i - 1];
  int sum = 0;
  for (int i = p; i >= 0; i--) {
    sum += a[i];
    if (sum > b[i]) return false;
  }
  return true;
}
int main() {
  memset(num, 0, sizeof(num));
  scanf("%d", &n);
  p = 0;
  long long ss = 1;
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%lld", &x);
    while (x > ss) p++, ss <<= 1;
    if (x == ss) s[p]++;
    if (x < ss) num[p - 1]++;
  }
  if (!check(s[0])) {
    printf("-1\n");
    return 0;
  }
  int ans = -1, l = 0, r = s[0];
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  for (int i = ans; i <= s[0]; i++) printf("%d ", i);
}
