#include <bits/stdc++.h>
using namespace std;
const int N = 100002;
bool is_power(long long t) {
  while ((t & 1) == 0) {
    t >>= 1;
  }
  return t == 1;
}
long long not_p_next[N];
int sum[N + 1];
void add_on_int(int c, int v) {
  sum[c]++;
  sum[v + 1]--;
}
int main() {
  int q, w, e, r, t, num;
  multiset<long long> all;
  cin >> num;
  for (int w = 0; w < num; w++) {
    long long temp;
    cin >> temp;
    all.insert(temp);
  }
  vector<long long> not_power;
  for (auto w : all) {
    if (!is_power(w)) {
      not_power.push_back(w);
    }
  }
  for (auto w : not_power) {
    all.erase(w);
  }
  for (int w = 0; w < not_power.size(); w++) {
    long long e = 1;
    for (; e < not_power[w]; e *= 2) {
      auto it = all.find(e);
      if (it == all.end()) {
        cout << "-1\n";
        return 0;
      }
      all.erase(it);
    }
    not_p_next[w] = e;
  }
  for (int w = 0; w < not_power.size(); w++) {
    while (1) {
      auto it = all.find(not_p_next[w]);
      if (it == all.end()) {
        break;
      }
      all.erase(it);
      not_p_next[w] *= 2;
    }
  }
  set<int> result;
  int num_units = all.count(1);
  if (num_units == 0) {
    if (all.size() > 0) {
      cout << "-1\n";
    } else {
      cout << not_power.size() << "\n";
    }
    return 0;
  }
  int sum_free = 0;
  for (int w = 1; w <= num_units; w++) {
    long long e = 2;
    while (1) {
      auto it = all.find(e);
      if (it == all.end()) {
        break;
      }
      all.erase(it);
      e *= 2;
    }
    while (1) {
      long long mx = *(--all.end());
      if (e < mx) {
        if (sum_free > 0) {
          sum_free--;
          all.erase(all.find(mx));
        } else {
          cout << "-1\n";
          return 0;
        }
      } else {
        break;
      }
    }
    sum_free++;
    int rest_not_unit = all.size() - num_units;
    int rest_num_units = num_units - w;
    int free_for_units = sum_free - rest_not_unit;
    if (free_for_units < 0) {
      continue;
    }
    int c = max(rest_num_units - free_for_units, 0);
    add_on_int(w + c / 2 + c % 2, w + rest_num_units);
  }
  int lok_sum = 0;
  for (int w = 0; w <= num; w++) {
    lok_sum += sum[w];
    if (lok_sum > 0) {
      result.insert(w);
    }
  }
  if (result.size() == 0) {
    cout << "-1\n";
    return 0;
  }
  for (auto w : result) {
    cout << w + not_power.size() << " ";
  }
  cout << "\n";
  return 0;
}
