#include <bits/stdc++.h>
using namespace std;
void sieve(const int N, std::vector<int>* primes, std::vector<bool>& bs) {
  bs.resize(N + 10);
  std::fill(bs.begin(), bs.end(), true);
  bs[0] = bs[1] = false;
  for (long long i = 2; i <= N; i++)
    if (bs[i]) {
      for (long long j = i * i; j <= N; j += i) bs[j] = false;
      if (primes != nullptr) primes->push_back(i);
    }
}
int firstGood(vector<int>& primes, vector<bool>& bs, vector<bool>& used,
              int K) {
  for (int i = K + 1; i < 2000000; i++) {
    bool good = true;
    for (long long j = 1; j * j <= i; j++)
      if (i % j == 0) {
        if (bs[j] and used[j]) good = false;
        if (bs[i / j] and used[i / j]) good = false;
      }
    if (good) {
      for (long long j = 1; j * j <= i; j++)
        if (i % j == 0) used[j] = used[i / j] = true;
      return i;
    }
  }
}
int main() {
  vector<int> primes;
  vector<bool> bs;
  sieve(2000000, &primes, bs);
  vector<bool> used;
  used.resize(2000000 + 10);
  std::fill(used.begin(), used.end(), false);
  int N;
  cin >> N;
  int v[N];
  int out[N];
  bool coping = true;
  int ind = 0;
  for (int i = 0; i < N; i++) {
    cin >> v[i];
    bool good = coping;
    if (good)
      for (long long j = 1; j * j <= v[i]; j++)
        if (v[i] % j == 0) {
          if (bs[j] and used[j]) good = false;
          if (bs[v[i] / j] and used[v[i] / j]) good = false;
        }
    if (good) {
      out[i] = v[i];
      for (long long j = 1; j * j <= v[i]; j++)
        if (v[i] % j == 0) used[j] = used[v[i] / j] = true;
    } else {
      while (used[primes[ind]]) ind++;
      if (coping) {
        int fg = firstGood(primes, bs, used, v[i]);
        out[i] = fg;
      } else {
        out[i] = primes[ind];
        used[primes[ind]] = true;
      }
      coping = false;
    }
  }
  for (int i = 0; i < N; i++) cout << out[i] << " ";
  return 0;
}
