#include <bits/stdc++.h>
using namespace std;
bool __hack = std::ios::sync_with_stdio(false);
auto __hack1 = cin.tie(nullptr);
namespace template_util {
constexpr int bytecount(uint64_t x) { return x ? 1 + bytecount(x >> 8) : 0; }
template <int N>
struct bytetype {};
template <uint64_t N>
struct minimal_uint : bytetype<bytecount(N)> {};
}  // namespace template_util
template <class T>
T next(istream& in) {
  T ret;
  in >> ret;
  return ret;
}
const int MAXN = 45;
bool canSolve(int n, vector<int> p2, vector<int> after) {
  vector<int> full_until(MAXN, 0);
  p2[0] -= n;
  int rows = n;
  for (int i = 1; i < MAXN; ++i) {
    if (p2[i] >= rows) {
      p2[i] -= rows;
    } else {
      full_until[i - 1] = rows - p2[i];
      rows = p2[i];
      p2[i] = 0;
    }
  }
  int need = 0;
  for (int i = 0; i < (MAXN); ++i) {
    after[i] += p2[i];
    need += after[i];
    need -= full_until[i];
    need = max(need, 0);
  }
  return need == 0;
}
void solve(istream& in, ostream& out) {
  int n = next<int>(in);
  vector<int> p2(MAXN);
  vector<int> after(MAXN);
  for (int i = 0; i < (n); ++i) {
    int64_t x = next<int64_t>(in);
    if (__builtin_popcountll(x) == 1) {
      ++p2[__builtin_ffsll(x) - 1];
    } else {
      ++after[63 - __builtin_clzll(x)];
    }
  }
  vector<int> res;
  for (int i = 1; i <= p2[0]; ++i) {
    if (canSolve(i, p2, after)) {
      res.push_back(i);
    }
  }
  if (res.empty()) {
    out << -1 << endl;
  } else {
    for (int x : res) {
      out << x << ' ';
    }
    out << endl;
  }
}
int main() {
  solve(cin, cout);
  return 0;
}
