#include <bits/stdc++.h>
using namespace std;
long long save[100005];
long long aa[100005];
int hihi[100005];
int main() {
  int n;
  scanf("%d", &n);
  memset(aa, 0, sizeof(aa));
  memset(aa, 0, sizeof(aa));
  int first = 0, second = 0, sum = 1;
  long long a;
  scanf("%I64d", &a);
  if (a != 1) {
    printf("-1\n");
    return 0;
  }
  hihi[second] = 1;
  aa[second++] = 1;
  for (int i = 1; i < n; i++) {
    scanf("%I64d", &a);
    if (a == 1)
      hihi[second] = 1, aa[second++] = 1, sum = second;
    else if (a == aa[second] * 2)
      hihi[second]++, aa[second++] = a;
    else if (second != 0 && a == aa[second - 1] * 2)
      hihi[0]++, aa[0] = a, second = 1;
    else {
      save[first++] = a;
    }
  }
  if (first > sum) {
    printf("-1\n");
    return 0;
  }
  int Min, Max = sum + 1;
  int add = first;
  for (int i = sum - 1; i >= 0 && add <= i + 1; i--) add += hihi[i], Min = i;
  long long v[100005];
  while (Min < Max - 1) {
    memset(v, 0, sizeof(v));
    int xx = 0;
    for (xx = 0; xx < first; xx++) v[xx] = save[xx];
    int mid = (Max + Min) / 2;
    for (int i = mid; i < sum; i++) {
      for (long long j = 1; j <= aa[i]; j *= 2)
        v[xx++] = j, assert(xx < 100000);
      ;
    }
    sort(v, v + xx);
    reverse(v, v + xx);
    int ok = 1;
    for (int i = 0; i < xx; i++) {
      if (v[i] > aa[i] * 2) ok = 0;
    }
    if (ok) {
      Max = mid;
    } else {
      Min = mid;
    }
  }
  if (Min == sum) {
    printf("-1\n");
  } else {
    printf("%d", Min + 1);
    for (int i = Min + 2; i <= sum; i++) printf(" %d", i);
  }
}
