#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define per(i, a, b) for(ll i = a; i >= b; i--)
#define all(v) begin(v), end(v)
#define st first
#define nd second
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
const int N = 1e5 + 5;
int tab[N];
int odp[N * 2 + 5];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
set<int> ava;
rep(i, 0, n){
ava.insert(2 * i + 1);
if(2 * i + 2 != n * 2) ava.insert(2 * i + 2);
cin >> tab[i];
}
odp[0] = tab[0];
ava.erase(tab[0]);
rep(i, 1, n){
// cout << ava.size() << endl;
if(tab[i] == tab[i - 1]){
odp[i * 2 - 1] = *ava.begin();
odp[i * 2] = *prev(ava.end());
ava.erase(ava.begin());
ava.erase(prev(ava.end()));
}
else if(tab[i] > tab[i - 1]){
if(ava.contains(tab[i])){
odp[i * 2 - 1] = tab[i];
odp[i * 2] = *prev(ava.end());
ava.erase(prev(ava.end()));
ava.erase(ava.find(tab[i]));
}
else{
odp[i * 2 - 1] = *prev(ava.end());
ava.erase(prev(ava.end()));
odp[i * 2] = *prev(ava.end());
ava.erase(prev(ava.end()));
}
}
else{
if(ava.contains(tab[i])){
odp[i * 2 - 1] = tab[i];
odp[i * 2] = *ava.begin();
ava.erase(ava.begin());
ava.erase(ava.find(tab[i]));
}
else{
odp[i * 2 - 1] = *ava.begin();
ava.erase(ava.begin());
odp[i * 2] = *ava.begin();
ava.erase(ava.begin());
}
}
}
rep(i, 0, n * 2 - 1){
cout << odp[i] << ' ';
}
}