#include<stdio.h>
int vi[10000001]={0};
int main(void)
{
int n, a, now = 2;
int ans;
scanf(“%d”, &n);
int flag = 0;
int i,j,k;
for (i = 1; i <= n; i++)
{
scanf(“%d”, &a);
ans = now;
if (!flag&&a>ans)
ans = a;
while (vi[ans])
ans++;
printf(“%d “, ans);
if (ans>a)
flag = 1;
for (j = now; j*j <= ans; j++)
{
if (ans%j)
continue;
while (ans%j == 0)
ans /= j;
if (!vi[j])
for (k = j; k<10000001; k += j)
vi[k] = 1;
}
if (ans != 1)
for ( j = ans; j<10000001; j += ans)
vi[j] = 1;
while (vi[now])
now++;
}
return 0;
}