#include <bits/stdc++.h>
using namespace std;
int n, low;
long long a[100100], las[100100];
map<long long, int> c, t;
bool check(int x) {
  t = c;
  t[1] -= x;
  for (int i = 1; i <= x; i++) {
    las[i] = 1;
    long long x = 2;
    while (t[x]) t[x]--, las[i] = x, x *= 2;
  }
  int p = 1;
  map<long long, int>::iterator it = t.end();
  if (it == t.begin()) return 1;
  while (it != t.begin() && (it == t.end() || !it->second)) it--;
  if (it->second == 0 && it == t.begin()) return 1;
  while (1) {
    if (p == x + 1) return 0;
    if (it->first > 2 * las[p]) return 0;
    it->second--;
    p++;
    while (it != t.begin() && !it->second) it--;
    if (it->second == 0 && it == t.begin()) break;
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", a + i);
    c[a[i]]++;
  }
  if (!check(c[1])) return puts("-1"), 0;
  int l = 1, r = c[1];
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      low = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  for (int i = low; i <= c[1]; i++) printf("%d ", i);
}
