#include <bits/stdc++.h>
using namespace std;
int num[64], oth[64];
int check(int x) {
  int res = num[0] - x;
  for (int i = 1; i <= 40; i++) {
    res += oth[i];
    if (x > num[i]) {
      res -= min(res, x - num[i]);
      x = num[i];
    } else
      res += num[i] - x;
  }
  return res == 0;
}
int main() {
  int n;
  scanf("%d", &n);
  long long ret = 1, x, cnt = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &x);
    while (ret < x) ret *= 2, cnt++;
    if ((ret ^ x) == 0)
      num[cnt]++;
    else
      oth[cnt]++;
  }
  int l = 1, r = num[0], ans = -1;
  while (r >= l) {
    int mid = l + r >> 1;
    if (check(mid))
      r = mid - 1, ans = mid;
    else
      l = mid + 1;
  }
  if (ans == -1) return 0 * printf("-1\n");
  for (int i = ans; i <= num[0]; i++)
    printf("%d%c", i, i == num[0] ? '\n' : ' ');
  return 0;
}
