#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int MOD = 1000 * 1000 * 1000 + 7;
const long long LINF = MOD * (long long)MOD;
const int MAX = 33000;
int n;
long long a;
map<long long, int> F, G;
int NUM[70];
int NUM2[70];
int A[75];
int A2[75];
bool ok() {
  int bal = 0;
  for (int i = (60) - 1; i >= (0); i--) {
    bal += A[i] - A[i + 1];
    if (bal < A2[i]) return false;
    bal -= A2[i];
  }
  return true;
}
int main() {
  cin >> n;
  int b = 0;
  for (int i = (0); i < (n); i++) {
    cin >> a;
    if (a & (a - 1)) {
      b++;
      int R = 0;
      while (a) {
        R++;
        a /= 2;
      }
      NUM2[R - 1]++;
    } else {
      int R = 0;
      while (a) {
        R++;
        a /= 2;
      }
      NUM[R - 1]++;
    }
  }
  bool ok2 = 0;
  for (int num = (max(b, 1)); num < (n + 1); num++) {
    if (num > NUM[0]) break;
    for (int i = (0); i < (60); i++) A2[i] = NUM2[i];
    int QWE = num;
    for (int i = (0); i < (60); i++) {
      if (NUM[i] > QWE) {
        A2[i] += NUM[i] - QWE;
        A[i] = QWE;
      } else {
        A[i] = NUM[i];
        QWE = NUM[i];
      }
    }
    if (ok()) cout << num << " ", ok2 = 1;
  }
  if (!ok2) cout << -1;
}
