#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 10;
long long a[M];
vector<int> equ, betw, ans;
bool Is(int len) {
  vector<int> e, b;
  e = equ, b = betw;
  if (e[0] < len) return false;
  b[1] += e[0] - len;
  for (int i = 1; i < 41; i++) {
    if (b[i] > len) return false;
    if (e[i] > len)
      b[i + 1] += (e[i] - len);
    else if (e[i] < len) {
      b[i] -= (len - e[i]);
      b[i] = max(0, b[i]);
      len = e[i];
    }
    b[i + 1] += b[i];
  }
  return true;
}
int main() {
  int n;
  scanf("%d", &n);
  ans.clear(), equ.clear(), betw.clear();
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  int po = 0;
  for (int i = 0; i < 42; i++) {
    equ.push_back(0);
    betw.push_back(0);
  }
  for (int i = 1; i <= n; i++) {
    while (a[i] > ((long long)1 << po)) {
      po++;
    }
    if (a[i] == ((long long)1 << po)) {
      equ[po]++;
    } else {
      betw[po]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (Is(i)) {
      ans.push_back(i);
    }
  }
  if (ans.size()) {
    for (int i = 0; i < ans.size(); i++) {
      printf("%d ", ans[i]);
    }
  } else {
    printf("-1");
  }
  printf("\n");
  return 0;
}
