#include <bits/stdc++.h>
using namespace std;
long long n, arr[100100];
map<long long, int> pow2, under;
int main() {
  scanf("%lld", &n);
  long long cpow = 1, po = 0;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
    while (cpow < arr[i]) cpow *= 2, po++;
    if (arr[i] < cpow)
      under[po]++;
    else if (arr[i] == cpow)
      pow2[po]++;
  }
  int found = 0;
  for (int i = 1; i <= pow2[0]; i++) {
    long long open = i;
    long long extras = 0;
    bool ok = true;
    for (int j = 0; j < 50; j++) {
      extras += under[j];
      long long cansupport = pow2[j];
      if (cansupport < open) {
        long long needfinish = open - cansupport;
        int numuse = min(extras, needfinish);
        extras -= numuse;
        open = cansupport;
      } else
        extras += (cansupport - open);
    }
    if (ok && extras <= open) {
      printf("%d ", i);
      found++;
    }
  }
  if (!found) printf("-1");
  printf("\n");
}
