#include <bits/stdc++.h>
using namespace std;
int A[60], B[60];
bool check(int m) {
  if (A[0] < m) return false;
  int last = B[0] + A[0] - m, useful = m;
  for (int i = 1; i < 60; ++i) {
    if (A[i] <= useful) {
      last -= useful - A[i];
      if (last < 0) last = 0;
      useful = A[i];
      last += B[i];
    } else {
      last += A[i] - useful + B[i];
    }
  }
  return last <= useful;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    long long x;
    scanf("%I64d", &x);
    int f = 0;
    for (int j = 0; j < 60; ++j) {
      if (1ll << j == x) {
        ++A[j];
        f = 1;
        break;
      }
    }
    if (f) continue;
    for (int j = 0; j < 60; ++j) {
      if (1ll << (j + 1) > x) {
        ++B[j];
        break;
      }
    }
  }
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    if (check(i)) {
      ++cnt;
      printf("%d ", i);
    }
  }
  if (cnt == 0) puts("-1");
  return 0;
}
