#include <bits/stdc++.h>
using namespace std;
clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
template <typename T>
void _F(const char *name, T arg1) {
  cerr << name << " = " << arg1 << '\n';
}
template <typename T, typename... Args>
void _F(const char *names, T arg1, Args... args) {
  const char *name = strchr(names, ',');
  cerr.write(names, name - names) << " = " << arg1 << '\n';
  _F(name + 2, args...);
}
template <typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &q) {
  in >> q.first >> q.second;
  return in;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> &q) {
  out << q.first << " " << q.second;
  return out;
}
template <typename T1, typename T2>
pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2) {
  return {p1.first + p2.first, p1.second + p2.second};
}
template <typename T1, typename T2>
pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2) {
  return {p1.first - p2.first, p1.second - p2.second};
}
void solve() {
  long long n;
  cin >> n;
  long long a[n];
  long long cnt[42] = {0};
  long long st[42] = {0};
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (__builtin_popcountll(a[i]) == 1) {
      long long j = __builtin_ctzll(a[i]);
      cnt[j]++;
    }
    long long k;
    for (long long j = 0; j < 41; j++) {
      if ((a[i] >> j) & 1) k = j;
    }
    st[k] = i + 1;
  }
  for (long long j = 1; j < 42; j++) st[j] = max(st[j], st[j - 1]);
  std::vector<long long> ans;
  for (long long i = 1; i <= n; i++) {
    long long use = 0, cur, pre, res;
    if (cnt[0] < i) continue;
    cur = pre = i;
    for (long long j = 0; j < 42; j++) {
      cur = min(cur, cnt[j]);
      use += cur;
      long long add = 0;
      if (j) {
        res = st[j - 1] - use + cur;
        if (res > 0) use += min(pre - cur, res);
      }
      pre = cur;
    }
    if (use == n) ans.push_back(i);
  }
  if (!(long long)((ans).size())) {
    cout << -1 << '\n';
    return;
  }
  for (auto u : ans) cout << u << " ";
  cout << '\n';
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  start = clock();
  cout << fixed << setprecision(12);
  for (long long i = 1; i <= t; ++i) {
    solve();
  }
  return 0;
}
