#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int maxn = 2e6 + 10;
int n;
int a[maxn], b[maxn], c[maxn];
bool is_prime[maxn], ok = false;
set<int> prime;
void sieve() {
  for (int i = 0; i < maxn; i++) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;
  for (int i = 2; i < maxn; i++) {
    if (is_prime[i]) {
      prime.insert(i);
      for (int j = i << 1; j < maxn; j += i) is_prime[j] = false;
    }
  }
}
bool judge(int N) {
  for (int i = 0; i < N; i++) {
    if (!prime.count(c[i])) return false;
  }
  return true;
}
int Phi(int x) {
  int cnt = 0;
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      c[cnt++] = i;
      while (x % i == 0) x /= i;
    }
  }
  if (x != 1) c[cnt++] = x;
  return cnt;
}
int getMin(int x) {
  if (ok) {
    x = *(prime.begin());
    prime.erase(prime.begin());
    return x;
  }
  int cnt = Phi(x);
  if (judge(cnt)) {
    for (int i = 0; i < cnt; i++) prime.erase(c[i]);
    return x;
  } else {
    while (!judge(cnt)) cnt = Phi(++x);
    for (int i = 0; i < cnt; i++) prime.erase(c[i]);
    ok = true;
    return x;
  }
}
int main() {
  sieve();
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++)
    printf("%d%c", getMin(a[i]), i == n - 1 ? '\n' : ' ');
  return 0;
}
