#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, sum2, sum1;
int sum[50], Now[50], Tmp[50];
long long A[maxn], po[50];
map<long long, int> mp, Log;
map<long long, int>::iterator it;
inline int Count(long long x) {
  int res = 0;
  while (x) {
    x >>= 1, res++;
  }
  return res;
}
inline bool Check(int mid) {
  memset(Now, 0, sizeof(Now));
  memcpy(Tmp, sum, sizeof(sum));
  for (int i = 1, j; i <= mid; ++i) {
    for (j = 0; j <= 40 && Tmp[j] > 0; ++j) Tmp[j]--;
    if (j == 0) return 0;
    Now[j - 1]++;
  }
  for (it = mp.begin(); it != mp.end(); ++it) {
    long long x = (*it).first, y = (*it).second;
    x = Log[x] - 1;
    while (y--) {
      while (!Now[x] && x <= 40) x++;
      if (x > 40) return 0;
      Now[x]--;
    }
  }
  for (int i = 0; i <= 40; ++i) {
    long long x = po[i], y = Tmp[i];
    x = Log[x];
    while (y--) {
      while (!Now[x] && x <= 40) x++;
      if (x > 40) return 0;
      Now[x]--;
    }
  }
  return 1;
}
inline void Solve() {
  int l = sum2, r = sum1, mid, ans = sum1 + 1;
  if (l > r) {
    puts("-1");
    return;
  }
  while (l <= r) {
    mid = (l + r) >> 1;
    if (Check(mid))
      r = mid - 1, ans = min(ans, mid);
    else
      l = mid + 1;
  }
  if (ans > sum1)
    puts("-1");
  else {
    while (ans <= sum1) {
      printf("%d ", ans);
      ans++;
    }
  }
}
inline void Init() {
  scanf("%d", &n);
  po[0] = 1;
  Log[1] = 0;
  for (int i = 1; i <= 40; ++i) {
    po[i] = po[i - 1] << 1;
    Log[po[i]] = i;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &A[i]);
    if (A[i] == 1) sum1++;
    if (Log.count(A[i]))
      sum[Log[A[i]]]++;
    else
      mp[A[i]]++, sum2++;
  }
  for (it = mp.begin(); it != mp.end(); ++it) {
    Log[(*it).first] = Count((*it).first);
  }
}
int main() {
  Init();
  Solve();
  return 0;
}
