#include <bits/stdc++.h>
using namespace std;
int main() {
  int num[88], n;
  long long table[42];
  long long b = 1;
  memset(num, 0, sizeof(num));
  for (int i = 0; i < 42; i++) {
    table[i] = b;
    b *= 2;
  }
  scanf("%d", &n);
  int ma = 0;
  int now = 0, flag = 0;
  for (int i = 0; i < n; i++) {
    long long t;
    scanf("%I64d", &t);
    if (t == 1) ma++;
    if (flag != -1) {
      if (t == table[now]) {
        num[now * 2]++;
      } else if (t < table[now + 1]) {
        num[now * 2 + 1]++;
      } else if (t == table[now + 1]) {
        now++;
        num[now * 2]++;
      } else {
        flag = -1;
      }
    }
  }
  if (flag == -1)
    printf("-1\n");
  else {
    int all = 0;
    for (int i = 0; i <= 43; i++) {
      if (num[i * 2] >= num[2 * (i + 1)]) {
        num[i * 2] = num[i * 2] - num[2 * (i + 1)];
      } else {
        int t = num[2 * (i + 1)];
        num[2 * (i + 1)] = num[i * 2];
        num[2 * i + 3] += (t - num[i * 2]);
        num[i * 2] = 0;
      }
    }
    int flag = 0;
    for (int i = 1; i <= ma; i++) {
      int re = 0;
      int nw = 0;
      int left = 0;
      int x = i;
      for (int j = now; j >= 0; j--) {
        if (x >= num[j * 2]) {
          x -= num[j * 2];
          re += num[j * 2];
          re -= num[j * 2 + 1];
        } else {
          re += x;
          re -= num[j * 2 + 1];
          left += (num[j * 2] - x) * (j + 1);
          x = 0;
          for (int k = j - 1; k >= 0; k--) {
            left += num[k * 2 + 1] + num[k * 2] * (k + 1);
          }
          re -= left;
          break;
        }
        if (re < 0) break;
      }
      if (re >= 0) {
        flag++;
        if (flag == 1)
          cout << i << endl;
        else
          cout << " " << i << endl;
      }
    }
    if (flag == 0) cout << -1;
    cout << endl;
  }
  return 0;
}
