#include <bits/stdc++.h>
using namespace std;
const long long nax = 1e5 + 5;
long long a[nax], b[nax];
long long n;
long long p[2000001];
vector<long long> prime;
bool had[2000001];
void input() {
  cin >> n;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
}
void sieve(long long n) {
  for (long long i = 2; i <= n; ++i) {
    if (p[i] == 0) {
      for (long long j = i * i; j <= n; j += i) {
        p[j] = 1;
      }
    }
  }
  for (long long i = 2; i <= n; ++i)
    if (p[i] == 0) prime.push_back(i);
}
void solve() {
  long long i = 1;
  sieve(2000000);
  for (i = 1; i <= n; ++i) {
    bool ok = true;
    long long now = a[i];
    for (long long j = 0;
         j < ((long long)prime.size()) && prime[j] * prime[j] <= now; ++j) {
      while (now % prime[j] == 0) {
        if (had[prime[j]]) {
          ok = false;
          break;
        }
        now /= prime[j];
      }
    }
    if (now != 1 && had[now]) ok = false;
    if (!ok) {
      break;
    } else {
      b[i] = a[i];
      now = a[i];
      for (long long j = 0;
           j < ((long long)prime.size()) && prime[j] * prime[j] <= now; ++j) {
        while (now % prime[j] == 0) {
          had[prime[j]] = true;
          now /= prime[j];
        }
      }
      if (now != 1) had[now] = true;
    }
  }
  if (i > n) {
    for (long long k = 1; k <= n; ++k) cout << b[k] << ' ';
    return;
  }
  for (long long k = a[i] + 1;; ++k) {
    bool ok = true;
    long long now = k;
    for (long long j = 0;
         j < ((long long)prime.size()) && prime[j] * prime[j] <= now; ++j) {
      while (now % prime[j] == 0) {
        if (had[prime[j]]) {
          ok = false;
          break;
        }
        now /= prime[j];
      }
      if (!ok) break;
    }
    if (now != 1 && had[now]) ok = false;
    if (ok) {
      b[i] = k;
      now = k;
      for (long long j = 0;
           j < ((long long)prime.size()) && prime[j] * prime[j] <= now; ++j) {
        while (now % prime[j] == 0) {
          had[prime[j]] = true;
          now /= prime[j];
        }
      }
      if (now != 1) had[now] = true;
      break;
    } else {
      continue;
    }
  }
  ++i;
  while (i <= n) {
    for (auto &c : prime) {
      if (!had[c]) {
        if (i <= n)
          b[i] = c;
        else
          break;
        ++i;
        had[c] = true;
      }
    }
  }
  for (long long k = 1; k <= n; ++k) cout << b[k] << ' ';
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1;
  while (t--) {
    input();
    solve();
  }
  return 0;
}
