#include<bits/stdc++.h>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;

int N;
int P[200200];
int F[200200];
int ans[200200];

signed main() {
    memset(F, -1, sizeof(F));
    cin >> N;
    rep(i, N) {
        cin >> P[i];
        if (F[P[i]] == -1)F[P[i]] = i;
    }
    int i = 0, k = 0;
    while (i < N) {
        while (i < F[k] || F[k] == -1) {
            ans[i] = k;
            ++i;
            if (i == N)break;
        }
        ++k;
    }
    rep(i, N) {
        cout << ans[i] << endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

vector<pair<int, int>> prime_factor(int n) {
    vector<pair<int, int>> ret;
    for (int i = 2; i * i <= n; i++) {
        if (n % i != 0) continue;
        int tmp = 0;
        while (n % i == 0) {
            tmp++;
            n /= i;
        }
        ret.push_back(make_pair(i, tmp));
    }
    if (n != 1) ret.push_back(make_pair(n, 1));
    return ret;
}

int main(void){
    
    int N; cin >> N;
    long long ans = 1;
    int data[N+1];
    
    for(int i=2;i<=N;i++){ data[i] = i; }
   
    for(int i=2;i<N;i++){
        vector<pair<int, int>> v = prime_factor(i);
        for(int j=0;j<v.size();j++){
            for(int k=0;k<v[j].second;k++){
                for(int l=i+1;l<=N;l++){
                    if(data[l] % v[j].first == 0){ data[l] /= v[j].first; break; } 
                }
            }
        }
    }
    
    for(int i=2;i<=N;i++){ ans *= data[i]; }
    ans++;
    cout << ans << endl;
    return 0;
}