#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long& x : a) cin >> x;
  vector<long long> cnt(44);
  vector<long long> step(44);
  long long p2 = 1, o2 = 0;
  for (long long i = 0; i < n; i++) {
    while (p2 * 2 <= a[i]) {
      p2 *= 2;
      o2 += 1;
    }
    long long c = 0;
    long long x = a[i];
    while (!(x & 1)) {
      x >>= 1;
      c++;
    }
    if (x != 1) {
      cnt[o2]++;
    } else {
      step[c]++;
    }
  }
  vector<long long> ans;
  for (long long i = 1; i <= step[0]; i++) {
    vector<long long> t(44);
    vector<long long> ost(44);
    ost = cnt;
    ost[0] += step[0] - i;
    long long b = i;
    for (long long j = 1; j < 44; j++) {
      long long m = step[j];
      long long mini = min(b, m);
      t[j - 1] = b - mini;
      ost[j] += m - mini;
      b = mini;
    }
    bool f = false;
    long long s1 = 0;
    long long s2 = 0;
    for (long long j = 0; j < 44; j++) {
      s2 += t[j];
      s2 -= ost[j];
    }
    if (s2 < 0) continue;
    s1 = s2;
    s2 = 0;
    long long j = 0;
    while (j < 44) {
      s1 += ost[j];
      s2 += t[j];
      if (s1 < s2) {
        f = true;
        break;
      }
      j++;
    }
    if (s1 > i) f = true;
    if (!f) {
      ans.push_back(i);
    }
  }
  for (long long& x : ans) cout << x << ' ';
  if (ans.size() == 0) cout << -1;
  return 0;
}
