#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
int n, gugu, cnt[65], b[N], c[N], cmt, Ans, Ans1;
long long a[N], _2[65];
priority_queue<int> q;
int main() {
  _2[0] = 1;
  int now = 0;
  for (int i = 1; i < 60; i++) _2[i] = _2[i - 1] << 1;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    while (a[i] > _2[now]) now++;
    if (a[i] == _2[now])
      cnt[now]++;
    else
      b[++gugu] = now - 1;
  }
  Ans1 = cnt[0];
  while (cnt[0]) {
    int i;
    for (i = 0; cnt[i]; i++) cnt[i]--;
    q.push(i - 1);
  }
  for (int i = 1; i <= now; i++)
    for (int j = 1; j <= cnt[i]; j++) b[++gugu] = i;
  sort(b + 1, b + gugu + 1);
  for (int i = gugu; i >= 1; i--)
    if (q.empty()) {
      puts("-1");
      return 0;
    } else {
      if (q.top() >= b[i])
        q.pop();
      else {
        puts("-1");
        return 0;
      }
      Ans++;
    }
  while (!q.empty()) c[++cmt] = q.top() + 1, q.pop();
  Ans += cmt;
  for (int i = 1, j = cmt;; j--, Ans--) {
    if (i + c[j] > j)
      break;
    else
      i = i + c[j];
  }
  for (int i = Ans; i <= Ans1; i++) printf("%d ", i);
}
