#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
long long a[maxn];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  int ma = 0;
  for (int j = 1; j <= n; ++j) {
    cin >> a[j];
    if (a[j] == 1) ++ma;
  }
  int r = ma + 1, l = 0;
  while (l + 1 < r) {
    int mid = (l + r) / 2;
    int mi = mid;
    int po = 1;
    queue<long long> oths;
    for (long long num = 1; num <= 1e13; num = num * 2) {
      int cs = 0;
      while (po <= n && a[po] <= num) {
        if (a[po] == num && cs < mi)
          ++cs;
        else
          oths.push(a[po]);
        ++po;
      }
      if (cs < mi) {
        int cha = mi - cs;
        for (int j = 1; j <= cha; ++j)
          if (oths.empty() == 0 && num >= oths.front()) oths.pop();
        mi = cs;
      }
    }
    if (oths.empty())
      r = mid;
    else
      l = mid;
  }
  if (r == ma + 1)
    cout << "-1" << endl;
  else {
    for (int j = r; j <= ma; ++j) cout << j << " ";
    cout << endl;
  }
  return 0;
}
