#include <bits/stdc++.h>
#define pi acos(-1)
#define fastcin ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const LL ll_INF = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 2e6 + 10;
const int mod = 1e9 + 7;
int n, a[100010];
int factor[MAXN];
bool used[MAXN];
void make_table()
{
fill(factor, factor+MAXN, 0);
fill(used, used+MAXN, false);
for(LL i=2; i<MAXN; i++){
if(factor[i]!=0) continue;
for(LL j=i*i; j<MAXN; j+=i){
if(factor[j]==0) factor[j] = i;
}
}
}
bool check(int x)
{
int tmp = x;
while(factor[tmp]){
if(used[factor[tmp]]) return false;
tmp /= factor[tmp];
} if(used[tmp]) return false;
while(factor[x]){
used[factor[x]] = true;
x /= factor[x];
} used[x] = true;
return true;
}
void solve(int i, int x)
{
for(int j=x+1; j<MAXN; j++){
if(check(j)){
printf("%d%c", j, " \n"[i==n]);
break;
}
}
i++;
for(int j=2; j<MAXN && i<=n; j++){
if(check(j)){
printf("%d%c", j, " \n"[j==n]);
i++;
}
}
}
int main()
{
make_table();
scanf("%d", &n);
for(int i=1; i<=n; i++) scanf("%d", &a[i]);
for(int i=1; i<=n; i++){
if(check(a[i])){
printf("%d%c", a[i], " \n"[i==n]);
}
else{
solve(i, a[i]);
break;
}
}
return 0;
}