#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e6 + 5;
bool f[maxn];
long long tot, a[maxn], pri[maxn], notprime[maxn], w[maxn];
void getprime(int siz) {
  for (int i = 2; i <= siz; i++) {
    if (!notprime[i]) pri[++tot] = i;
    for (int j = 1; j <= tot && pri[j] * i <= siz; j++) {
      notprime[i * pri[j]] = 1;
      if (i % pri[j] == 0) break;
    }
  }
}
bool ok(int x) {
  while (x > 1) {
    if (f[w[x]]) return false;
    x /= w[x];
  }
  return true;
}
void update(int x) {
  while (x > 1) {
    f[w[x]] = 1;
    x /= w[x];
  }
}
int main() {
  getprime(maxn);
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= tot; i++) {
    for (int j = pri[i]; j <= maxn; j += pri[i]) {
      if (!w[j]) {
        w[j] = pri[i];
      }
    }
  }
  int flag = 0;
  int xxx = 2;
  for (int i = 1; i <= n; i++) {
    int ac;
    if (flag == 0)
      ac = a[i];
    else
      ac = xxx;
    while (!ok(ac)) ac++;
    if (flag) xxx = ac + 1;
    if (ac > a[i]) flag = 1;
    printf("%d", ac);
    char cc = (i == n) ? '\n' : ' ';
    printf("%c", cc);
    update(ac);
  }
  return 0;
}
