#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
int d[N+500], k, h, cnt, a[N+89];
int n;
set<int>s;
int main() {
   k = 1;
   while(h <= N)
   {
       h += k;
       if(h <= N) {
           d[h] = k;
           cnt++;
       }
       k*=2;
   }
   cin >> n;
   for(int i = 1; i <= n; i++) {
    cin >> a[i];
    s.insert(a[i]);
   }
   if(s.size() != d[n]) cout << -1;
   else {
    for(auto to: s) {
        cout << to << ' ';
    }
   }

}
