#include <bits/stdc++.h> 
#define ll long long 
#define int long long 
#define Sayan ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) 
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout) 
#define all(a) a.begin() , a.end() 
#define Int(a,x) a+1 , a+1+x 
#define sz() size() 
#define F first 
#define S second 
#define pb push_back 
#define yes cout << "YES\n" 
#define no cout << "NO\n" 
#define pii pair<ll,ll> 
using namespace std ; 
 
const ll N = 2e5+5; 
const ll INF = 1e18; 
const ll mod = 1e9+7; 
ll binpow(ll a , ll b){ 
    if(b == 0) return 1; 
    if(b%2) return binpow(a , b-1) * a % mod; 
    ll c = binpow(a , b/2) % mod; 
    return c*c%mod; 
} 
ll a[N]; 
void solve(){ 
  ll n; 
  cin>>n; 
  set<ll>st; 
//  ll a[N]; 
  for(ll i=1;i<=n;i++){ 
   cin>>a[i]; 
   st.insert(a[i]); 
  } 
  ll cur=n+1; 
  ll otv=0; 
  for(ll i=30;i>=1;i--){ 
   if(binpow(2,i)==cur){ 
    otv=i-1; 
    break; 
   } 
  } 
  if(st.sz()!=binpow(2,otv))cout<<"-1\n"; 
  else { 
   for(auto to:st){ 
    cout<<to<<" "; 
   } 
  } 
} 
signed main () { 
 Sayan; 
 int tt=1; 
 while(tt--){ 
  solve(); 
 } 
}
