#include <bits/stdc++.h>
using namespace std;
int n;
int pow2[50];
int l[50];
int level(long long p) {
  long long comp = 1;
  int ans = 0;
  while (comp <= p) {
    comp <<= 1;
    ans++;
  }
  return ans - 1;
}
bool ispow2(long long p) {
  long long comp = 1;
  while (comp < p) {
    comp <<= 1;
  }
  return comp == p;
}
bool viable(int cnt) {
  int le[50];
  for (int i = 0; i < 50; i++) le[i] = l[i];
  int slot[50];
  for (int i = 0; i < 50; i++) slot[i] = 0;
  for (int i = 0; i < 50; i++) {
    if (i == 0) {
      if (pow2[i] > cnt) {
        slot[i] = cnt;
        le[i] += pow2[i] - cnt;
      } else {
        slot[i] = pow2[i];
      }
    } else {
      if (pow2[i] > slot[i - 1]) {
        slot[i] = slot[i - 1];
        le[i] += pow2[i] - slot[i];
      } else {
        slot[i] = pow2[i];
      }
    }
  }
  int sum = 0;
  for (int i = 49; i >= 0; i--) {
    sum += le[i];
    if (sum > slot[i]) return false;
  }
  return true;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    if (ispow2(a))
      pow2[level(a)]++;
    else
      l[level(a)]++;
  }
  if (!viable(pow2[0])) {
    cout << -1 << endl;
    return 0;
  }
  int ansl = pow2[0];
  while (ansl > 1 && viable(ansl - 1)) ansl--;
  for (int i = ansl; i <= pow2[0]; i++) {
    if (viable(i)) cout << i << ' ';
  }
  cout << endl;
  return 0;
}
