#include <bits/stdc++.h>
using namespace std;
long long a[100100];
const int N = 60;
unordered_map<long long, int> powerIndex;
int powerCnt[N];
vector<int> len;
vector<int> ans;
vector<int> haveChains;
vector<int> haveLeftOvers;
void outAns() {
  if (ans.size() == 0) {
    cout << -1 << endl;
    return;
  }
  sort(ans.begin(), ans.end());
  for (int i = (0); i < (ans.size()); ++i) {
    if (i) {
      printf(" ");
    }
    printf("%d", ans[i]);
  }
  cout << endl;
}
inline bool match(vector<int> haveChains, vector<int> haveLeftOvers) {
  for (int i = (int)haveChains.size() - 1; i >= 0; --i) {
    if (haveLeftOvers[i] > haveChains[i]) {
      return false;
    }
    if (i) {
      haveChains[i - 1] += haveChains[i] - haveLeftOvers[i];
    }
  }
  return true;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (0); i < (N); ++i) {
    powerIndex[(1ll << i)] = i;
  }
  for (int i = (0); i < (n); ++i) {
    scanf("%I64d", &a[i]);
    if ((a[i] & (a[i] - 1)) == 0) {
      powerCnt[powerIndex[a[i]]]++;
    }
  }
  if (powerCnt[0] == 0) {
    cout << -1 << endl;
    return 0;
  }
  len.resize(powerCnt[0]);
  int tot = powerCnt[0];
  for (int chainNumber = (0); chainNumber < (tot); ++chainNumber) {
    int index = 0;
    while (1) {
      if (powerCnt[index] == 0) {
        break;
      }
      powerCnt[index]--;
      index++;
    }
    len[chainNumber] = index;
  }
  reverse(len.begin(), len.end());
  haveChains.resize(N, 0);
  haveLeftOvers.resize(N, 0);
  for (int i = (0); i < (len.size()); ++i) {
    haveChains[len[i] - 1]++;
  }
  for (int i = (1); i < (N); ++i) {
    haveLeftOvers[i - 1] += powerCnt[i];
  }
  for (int i = (0); i < (n); ++i) {
    if ((a[i] & (a[i] - 1)) != 0) {
      int index = 0;
      for (int j = (0); j < (N); ++j) {
        if ((1ll << j) < a[i]) {
          index = j;
        }
      }
      haveLeftOvers[index]++;
    }
  }
  for (int i = (0); i < (len.size()); ++i) {
    if (match(haveChains, haveLeftOvers)) {
      ans.push_back(len.size() - i);
      haveChains[len[i] - 1]--;
      for (int j = (0); j < (len[i]); ++j) {
        if (j == 0) {
          haveLeftOvers[j]++;
        } else {
          haveLeftOvers[j - 1]++;
        }
      }
    } else {
      break;
    }
  }
  outAns();
  return 0;
}
