#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 123;
const int MOD = (int)1e9 + 7;
const int inf = (int)5e8;
const long long infll = (long long)1e17;
long long a[N];
map<long long, int> cnt;
map<int, int> have;
void solve() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &a[i]);
    ++cnt[a[i]];
    if (a[i] == 1) {
      a[i] = 0;
    }
  }
  have[0] = cnt[1];
  for (long long i = 1; i < 60; ++i) {
    long long val = 1ll << i;
    int kek = 0;
    while (cnt[val] > 0) {
      if (have[i - 1] > 0) {
        ++have[i];
        --have[i - 1];
        --cnt[val];
      } else {
        kek = cnt[val];
        break;
      }
    }
    for (int j = 0; j < n; ++j) {
      if (a[j] == val) {
        if (kek > 0) {
          --kek;
        } else {
          a[j] = 0;
        }
      }
    }
  }
  int ans = cnt[1];
  for (int i = n - 1; i >= 0; --i) {
    if (a[i]) {
      bool found = false;
      for (int j = 60; j >= 0; --j) {
        if (have[j] > 0) {
          if (a[i] <= (1ll << (j + 1))) {
            --have[j];
            found = true;
            break;
          }
        }
      }
      if (!found) {
        printf("-1\n");
        return;
      }
    }
  }
  vector<int> possible = {ans};
  for (int i = 0; i < 60; ++i) {
    while (have[i] > 0) {
      --have[i];
      bool fail = false;
      for (int j = i; j >= 0; --j) {
        bool found = false;
        for (int k = 60; k >= i; --k) {
          if (have[k] > 0) {
            --have[k];
            found = true;
            break;
          }
        }
        if (!found) {
          fail = true;
          break;
        }
      }
      if (fail) {
        break;
      }
      --ans;
      possible.push_back(ans);
    }
  }
  sort(possible.begin(), possible.end());
  for (auto i : possible) {
    printf("%d ", i);
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
