#include <bits/stdc++.h>
using namespace std;
set<int, greater<int> > x;
queue<int> q;
bool ok(set<int, greater<int> >::iterator it) {
  if (*it == 1) return 0;
  set<int, greater<int> >::iterator tp = x.find(*it / 2);
  if (tp == x.end()) {
    x.insert(*it / 2);
    return 1;
  }
  return ok(tp);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    x.insert(a);
  }
  int f = 1;
  while (ok(x.begin())) x.erase(x.begin());
  for (set<int, greater<int> >::iterator it = x.begin(); it != x.end(); it++)
    printf("%d ", *it);
  return 0;
}
