#include <bits/stdc++.h>
using namespace std;
int n, cnt[60], tot, ans[100010], m, Count[60], maxb;
long long a[100010], pow2[60], w[100010];
bool check(int x) {
  for (int i = 0; i <= 55; i++) Count[i] = cnt[i];
  int now = 1, temp = 0, type = 0;
  for (int i = 0; i <= 55; i++) {
    if (Count[i] >= x)
      Count[i] -= x;
    else {
      while (Count[i] < x && w[now] < pow2[i] && now <= tot) {
        x--;
        now++;
      }
      while (!Count[temp] && temp <= 55) temp++;
      while (Count[i] < x && temp < i) {
        int t = min(x - Count[i], Count[temp]);
        x -= t;
        Count[temp] -= t;
        while (!Count[temp] && temp <= 55) temp++;
      }
      if (Count[i] < x) x = Count[i];
      Count[i] -= x;
    }
    if (x <= 0) break;
    if (i == maxb && now == tot + 1) {
      int type = 0;
      for (int j = 0; j <= i; j++)
        if (Count[j]) {
          type = 1;
          break;
        }
      if (!type) return 1;
    }
  }
  if (now != tot + 1) return 0;
  for (int i = 0; i <= 55; i++)
    if (Count[i]) return 0;
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  sort(a + 1, a + n + 1);
  pow2[0] = 1;
  for (int i = 1; i <= 55; i++) pow2[i] = pow2[i - 1] * 2ll;
  tot = 0;
  int now = 0;
  for (int i = 1; i <= n; i++) {
    if (pow2[now] < a[i]) now++;
    if (pow2[now] == a[i]) {
      cnt[now]++;
      maxb = max(maxb, now);
    } else
      w[++tot] = a[i];
  }
  for (int i = 1; i <= cnt[0]; i++) {
    if (check(i)) ans[++m] = i;
  }
  if (!m)
    printf("-1");
  else {
    for (int i = 1; i <= m; i++) printf("%d ", ans[i]);
  }
  return 0;
}
