#include <bits/stdc++.h>
using namespace std;
long long n, a[100010], powNum[43];
signed main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    for (long long j = 0; j < 43; ++j) {
      if (a[i] == (1LL << j)) {
        ++powNum[j];
      }
    }
  }
  bool ok = 0;
  for (long long i = 0; i <= n; ++i) {
    long long used = 0, curTops = i;
    if (powNum[0] < i) {
      break;
    }
    for (long long j = 0; j < 43; ++j) {
      used += min(powNum[j], curTops);
      long long freeSpots = max(0LL, curTops - powNum[j]);
      long long toAdd = (upper_bound(a, a + n, (1LL << j)) - a) - used;
      used += min(freeSpots, toAdd);
      curTops = min(curTops, powNum[j]);
      if (!curTops) {
        break;
      }
    }
    if (used == n) {
      ok = 1;
      cout << i << ' ';
    }
  }
  if (!ok) {
    cout << -1;
  }
}
