#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535897932384626433832795l;
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T1, typename T2>
inline bool umx(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1& a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
struct Input {
  int n;
  vector<int64_t> a;
  bool read() {
    if (scanf("%d", &n) != 1) return 0;
    a.resize(n);
    for (int i = int(0); i < int(n); ++i) {
      scanf("%" SCNd64, &a[i]);
    }
    return 1;
  }
  void init(const Input& input) { *this = input; }
};
struct Data : Input {
  vector<int> ans;
  void write() {
    if (ans.empty()) {
      printf("-1\n");
    } else {
      for (int x : ans) {
        printf("%d ", x);
      }
      printf("\n");
    }
  }
};
const int B_SIZE = 42;
struct Solution : Data {
  vector<int> ncnt, bcnt;
  bool can(int m) {
    vector<int> good, rest;
    good.assign(B_SIZE, 0);
    rest = good;
    vector<int> t_ncnt = ncnt;
    if (t_ncnt[0] < m) {
      return false;
    }
    int mval = m;
    for (int i = 0; i < B_SIZE; ++i) {
      int nval = min(mval, t_ncnt[i]);
      int diff = mval - nval;
      t_ncnt[i] -= nval;
      good[i] = diff;
      mval = nval;
    }
    for (int i = 0; i < B_SIZE; ++i) {
      rest[i] = t_ncnt[i] + bcnt[i];
    }
    int accum = 0;
    for (int i = 40; i >= 0; --i) {
      if (accum + good[i] < rest[i]) {
        return false;
      }
      accum += good[i] - rest[i];
    }
    return true;
  }
  void solve() {
    ans.clear();
    ncnt.assign(B_SIZE, 0);
    bcnt = ncnt;
    for (int64_t x : a) {
      int pos = 0;
      while (x > (1ll << pos)) pos++;
      if (x == (1ll << pos)) {
        ncnt[pos]++;
      } else {
        bcnt[pos]++;
      }
    }
    int lm = (ncnt[0] + 1) / 2, rm = ncnt[0];
    for (int tm = lm; tm <= rm; ++tm) {
      if (can(tm)) ans.push_back(tm);
    }
  }
  void clear() { *this = Solution(); }
};
Solution sol;
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  sol.read();
  sol.solve();
  sol.write();
  return 0;
}
