#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) { return a > b; }
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a * (b / gcd(a, b));
}
long long n, a[5000005], pw[300], btw[300];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    for (long long j = 0; j < 50; j++) {
      long long val = 1LL << j;
      if (a[i] < val) {
        btw[j - 1]++;
        break;
      } else if (a[i] == val) {
        pw[j]++;
        break;
      }
    }
  }
  bool fd = false;
  for (long long i = 1; i <= pw[0]; i++) {
    long long ct = 0;
    long long need = i;
    for (long long j = 0; j < 50; j++) {
      if (pw[j] >= need) {
        ct += pw[j] - need;
      } else {
        ct -= need - pw[j];
        ct = max(0LL, ct);
        need = pw[j];
      }
      ct += btw[j];
    }
    if (ct == 0) {
      cout << i << " ";
      fd = true;
    }
  }
  if (!fd) {
    cout << -1;
  }
  cout << endl;
  return 0;
}
