#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10000 + 7;
const int oo = 0x3f3f3f3f;
const long long loo = 4223372036854775807ll;
const long long mod = 1e9 + 7;
int power[70 + 10];
int between[70 + 10];
int sy[70 + 10];
int xl[70 + 10];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n;
  while (cin >> n) {
    memset(power, 0, sizeof(power));
    memset(between, 0, sizeof(between));
    memset(sy, 0, sizeof(sy));
    memset(xl, 0, sizeof(xl));
    for (int i = 0; i < n; i++) {
      long long t;
      cin >> t;
      int p = 0;
      bool fl = false;
      while (t > 1) {
        if (t & 1) fl = true;
        t = t >> 1;
        p++;
      }
      if (fl)
        between[p]++;
      else
        power[p]++;
    }
    int l = 1, r = power[0] + 1;
    while (l < r) {
      int mid = (l + r) / 2;
      int now = mid;
      for (int i = 0; i <= 70; i++) {
        sy[i] = power[i] - now;
        int tnow = now;
        if (power[i + 1] < tnow) {
          tnow = power[i + 1];
        }
        xl[i] = now - tnow;
        now = tnow;
      }
      bool fl = false;
      int tt = 0;
      for (int i = 70; i >= 0; i--) {
        tt += xl[i];
        tt -= between[i];
        tt -= sy[i + 1];
        if (tt < 0) {
          fl = true;
          break;
        }
      }
      tt -= sy[0];
      if (tt < 0) {
        fl = true;
      }
      if (fl) {
        l = mid + 1;
      } else {
        r = mid;
      }
    }
    if (l <= power[0]) {
      for (int i = l; i <= power[0]; i++) {
        cout << i << ' ';
      }
      cout << endl;
    } else
      cout << -1 << endl;
  }
  return 0;
}
