#include <bits/stdc++.h>
using namespace std;
int Scan() {
  int res = 0, flag = 0;
  char ch;
  if ((ch = getchar()) == '-') {
    flag = 1;
  } else if (ch >= '0' && ch <= '9') {
    res = ch - '0';
  }
  while ((ch = getchar()) >= '0' && ch <= '9') {
    res = res * 10 + (ch - '0');
  }
  return flag ? -res : res;
}
void Out(int a) {
  if (a < 0) {
    putchar('-');
    a = -a;
  }
  if (a >= 10) {
    Out(a / 10);
  }
  putchar(a % 10 + '0');
}
void test1() {
  for (int i = 0; i < 100; ++i)
    ;
}
void test2() {
  for (int i = 0; i < 1000; ++i)
    ;
}
void checksta() {}
int x, y, p, q;
int n, m;
long long a[1000005];
long long bin[100];
int flag[100];
int num[1000005];
int maxx[1000005];
vector<long long> ha;
vector<int> ans;
int main() {
  scanf("%d", &n);
  bin[0] = 1;
  for (int i = 1; i <= 60; i++) bin[i] = bin[i - 1] * 2ll;
  memset(flag, 0, sizeof flag);
  memset(num, 0, sizeof num);
  int sum = 0;
  ha.clear();
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    int f = 0;
    for (int j = 0; j <= 60; j++) {
      if (bin[j] == a[i]) flag[j]++, sum++, f = 1;
    }
    if (f == 0) ha.push_back(a[i]);
  }
  sum = n - sum;
  int cun = 0;
  while (flag[0] > 0) {
    cun++;
    int cur = 0;
    while (flag[cur] > 0) flag[cur]--, cur++, num[cun]++;
    maxx[cun] = cur;
  }
  for (int i = 0; i <= 60; i++) {
    sum += flag[i];
    while (flag[i] > 0) flag[i]--, ha.push_back(bin[i]);
  }
  sort(ha.begin(), ha.end());
  if (cun == 0) {
    cout << -1 << endl;
    return 0;
  }
  int j = 1;
  for (int i = (int)ha.size() - 1; i >= 0; i--, j++)
    if (j > cun || bin[maxx[j]] < ha[i]) {
      cout << -1 << endl;
      return 0;
    }
  ans.clear();
  while (cun >= sum) {
    ans.push_back(cun);
    sum += num[cun];
    cun--;
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) printf("%d ", ans[i]);
  puts("");
  return 0;
}
