#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int N;
long long seq[MAXN];
long long p2[66];
int cntp2[66], cntr[66];
int len[MAXN];
int main() {
  p2[0] = 1;
  for (int i = 1; i <= 62; i++) {
    p2[i] = p2[i - 1] + p2[i - 1];
  }
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> seq[i];
    bool p2flg = false;
    for (int j = 0; j <= 62; j++) {
      if (seq[i] == p2[j]) {
        cntp2[j]++;
        p2flg = true;
        break;
      }
    }
    if (!p2flg) {
      for (int j = 0; j <= 62; j++) {
        if (seq[i] <= p2[j]) {
          cntr[j]++;
          break;
        }
      }
    }
  }
  vector<int> vec;
  int mxc = cntp2[0];
  for (int i = 1; i <= mxc; i++) {
    if (cntp2[0] == 0) {
      int sum = 0;
      for (int j = 0; j <= 62; j++) {
        sum += cntp2[j] + cntr[j];
      }
      if (!sum) vec.push_back(i);
      continue;
    }
    for (int j = 0; j <= 62; j++) {
      if (cntp2[j]) {
        cntp2[j]--;
        len[i]++;
      } else {
        break;
      }
    }
    bool remgot = false;
    for (int j = len[i]; j >= 0; j--) {
      if (cntr[j]) {
        remgot = true;
        cntr[j]--;
        break;
      }
    }
    if (!remgot) {
      int mxt = -1, mxi = -1;
      for (int j = len[i]; j >= 0; j--) {
        if (cntp2[j] > mxt) {
          mxt = cntp2[j];
          mxi = j;
        }
      }
      if (mxt) cntp2[mxi]--;
    }
    int sum = 0;
    for (int j = 0; j <= 62; j++) {
      sum += cntp2[j] + cntr[j];
    }
    if (!sum) vec.push_back(i);
  }
  if (vec.size() == 0)
    cout << -1 << endl;
  else
    for (auto x : vec) cout << x << ' ';
  return 0;
}
