#include <bits/stdc++.h>
using namespace std;
int n;
long long a[100100];
bool check(int k) {
  int lost = 0, open = 0;
  int pos = 0;
  for (long long i = 0; i < 50; ++i) {
    long long cur_p = (1ll << i);
    while (a[pos] < cur_p) {
      ++lost;
      ++pos;
      if (pos == n) {
        break;
      }
    }
    if (pos == n) {
      break;
    }
    int cur_cnt = 0;
    while (a[pos] == cur_p) {
      ++cur_cnt;
      ++pos;
      if (pos == n) {
        break;
      }
    }
    if (cur_p == 1) {
      open = k;
      lost = cur_cnt - k;
      if (pos == n) {
        break;
      }
      continue;
    }
    if (cur_cnt == 0) {
      break;
    }
    if (cur_cnt >= open) {
      lost += cur_cnt - open;
    } else {
      int closed = open - cur_cnt;
      lost = max(0, lost - closed);
      open = cur_cnt;
    }
    if (pos == n) {
      break;
    }
  }
  if (pos < n) {
    return false;
  }
  if (lost > open) {
    return false;
  }
  return true;
}
void solve(int t) {
  scanf("%d", &n);
  int cnt1 = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &a[i]);
    if (a[i] == 1) {
      ++cnt1;
    }
  }
  if (cnt1 == 0) {
    printf("-1\n");
    return;
  }
  int r = cnt1;
  int l = (cnt1 + 1) / 2;
  int lb = l, rb = r;
  while (lb != rb) {
    int mb = (lb + rb) / 2;
    if (check(mb)) {
      rb = mb;
    } else {
      lb = mb + 1;
    }
  }
  if (!check(lb)) {
    printf("-1\n");
    return;
  }
  for (int i = lb; i <= r; ++i) {
    printf("%d ", i);
  }
}
int main() {
  int tests;
  tests = 1;
  for (int i = 1; i <= tests; ++i) {
    solve(i);
  }
  return 0;
}
