#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200001;
int pw[63], cnt[63], n, pcnt[63], ppw[63];
long long a[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  int mx = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    int j = 0;
    while (a[i] > (1LL << j)) {
      j++;
    }
    cnt[j]++;
    if (a[i] == (1LL << j)) {
      pw[j]++;
      mx = max(j, mx);
    }
  }
  vector<int> ans;
  for (int i = 1; i <= pw[0]; i++) {
    int last[63];
    memset(last, 0, sizeof(last));
    memcpy(ppw, pw, sizeof(pcnt));
    memcpy(pcnt, cnt, sizeof(pcnt));
    last[0] = i;
    ppw[0] -= i;
    pcnt[0] -= i;
    for (int j = 1; j <= mx; j++) {
      int mmn = min({last[j - 1], ppw[j]});
      last[j - 1] -= mmn;
      last[j] = mmn;
      ppw[j] -= mmn;
      pcnt[j] -= mmn;
    }
    for (int j = 0; j <= mx; j++) {
      for (int k = j + 1; k >= 0 && last[j]; k--) {
        int mmn = min(last[j], pcnt[k]);
        last[j] -= mmn;
        pcnt[k] -= mmn;
      }
    }
    bool ck = true;
    for (int i = 0; i < 63; i++) {
      if (pcnt[i]) ck = false;
    }
    if (ck) ans.push_back(i);
  }
  if (ans.size() == 0)
    cout << -1;
  else {
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i] << ' ';
    }
  }
  return 0;
}
