#include <bits/stdc++.h>
using namespace std;
const int MAX = 66;
int power[MAX + 10];
int between[MAX + 10];
int extra[MAX + 10];
int ende[MAX + 10];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long foo;
    cin >> foo;
    int cc = 0;
    bool good = true;
    while (foo > 1) {
      if (foo & 1) {
        good = false;
      }
      cc++;
      foo >>= 1;
    }
    if (good) {
      power[cc]++;
    } else {
      between[cc]++;
    }
  }
  int low = 1, high = power[0] + 1;
  while (low < high) {
    int mid = (low + high) >> 1;
    int cur = mid;
    for (int i = 0; i < MAX; i++) {
      extra[i] = power[i] - cur;
      int new_cur = min(cur, power[i + 1]);
      ende[i] = cur - new_cur;
      cur = new_cur;
    }
    bool fail = false;
    int open = 0;
    for (int i = MAX - 1; i >= 0; i--) {
      open += ende[i];
      open -= between[i];
      open -= extra[i + 1];
      if (open < 0) {
        fail = true;
        break;
      }
    }
    open -= extra[0];
    if (open < 0) {
      fail = true;
    }
    if (fail) {
      low = mid + 1;
    } else {
      high = mid;
    }
  }
  if (low > power[0]) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = low; i <= power[0]; i++) {
    cout << i << " ";
  }
  cout << endl;
  return 0;
}
