#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long double EPS = 1e-8;
const long double PI = acos(-1.0L);
const int MAXN = 1e5;
const int LOG = 60;
int cp[LOG];
int cr[LOG];
int sumr[LOG];
int main() {
  int n;
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  int ans = 0;
  for (int i = int(0); i < int(n); ++i) {
    long long a;
    cin >> a;
    if (__builtin_popcountll(a) == 1) {
      cp[__builtin_popcountll(a - 1)]++;
    } else {
      ans++;
      int k = 0;
      while ((((long long)1) << k) <= a) {
        cp[k]--;
        k++;
      }
      cr[k]++;
    }
  }
  for (int j = LOG - 1; j > 0; --j) {
    if (cp[j] < 0) {
      cout << -1 << '\n';
      return 0;
    }
  }
  bool fail = true;
  for (int i = 0; i <= cp[0]; ++i) {
    int s = i;
    int fs = i;
    bool good = true;
    for (int j = 0; j < LOG; ++j) {
      s += cr[j];
      if (cp[j] > s + fs) {
        good = false;
        break;
      }
      s = min(cp[j], s);
      fs -= max(0, cp[j] - s);
      assert(fs >= 0);
      fs = min(s, fs);
    }
    if (good) {
      fail = false;
      cout << i + ans << ' ';
    }
  }
  if (fail) cout << -1;
  cout << '\n';
  return 0;
}
