#include <bits/stdc++.h>
using namespace std;
int cnt[43];
set<long long> help;
map<long long, int> mp;
int cur[43];
int lft[43];
vector<int> fin;
int val(long long tmp) {
  int cn = 0;
  while (tmp) {
    tmp /= 2;
    cn++;
  }
  return cn;
}
int main() {
  int n;
  scanf("%d", &n);
  for (long long i = 1; i <= 2e12; i = i * 2) {
    help.insert(i);
    mp[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    long long a;
    scanf("%lld", &a);
    if (help.find(a) != help.end()) {
      mp[a]++;
    }
    cnt[val(a)]++;
  }
  int ans = 0;
  int num = 0;
  while (true) {
    long long lst = 0;
    for (map<long long, int>::iterator it = mp.begin(); it != mp.end(); it++) {
      if (it->second == 0) {
        break;
      } else {
        lst = it->first;
      }
    }
    if (lst == 0) {
      break;
    }
    num++;
    cur[val(lst)]++;
    int yu = 1;
    for (long long i = 1; i <= lst; i = i * 2) {
      cnt[yu]--;
      mp[i]--;
      yu++;
    }
    for (int i = 0; i <= 42; i++) {
      lft[i] = cur[i];
    }
    int flg = 0;
    for (int i = 42; i >= 1; i--) {
      if (i != 42) {
        lft[i] += lft[i + 1];
      }
      if (lft[i] >= cnt[i]) {
        lft[i] -= cnt[i];
      } else {
        flg = 1;
        break;
      }
    }
    if (flg == 0) {
      fin.push_back(num);
      ans++;
    }
  }
  if (ans == 0) {
    printf("-1\n");
  } else {
    for (int i = 0; i < fin.size(); i++) {
      printf("%d ", fin[i]);
    }
  }
  return 0;
}
