#include <bits/stdc++.h>
const long long int MOD = 1e9 + 7;
const long long int INF = 1011111111;
const long long int LLINF = 1000111000111000111LL;
const long double EPS = 1e-10;
const long double PI = 3.14159265358979323;
using namespace std;
long long int power(long long int base, long long int exponent) {
  long long int ans = 1;
  while (exponent != 0) {
    if (exponent & 1) ans = (1LL * ans * base);
    base = (1LL * base * base);
    exponent >>= 1;
  }
  return ans;
}
const long long int N = 3 * 1e6;
set<long long int> primes;
bool prime[N + 5];
long long int spf[N + 5];
void seive() {
  for (long long int i = 2; i <= N; i++) {
    if (!prime[i]) {
      spf[i] = i;
      for (long long int j = 2; j * i <= N; j++) {
        prime[j * i] = true;
        if (spf[i * j] == 0) spf[i * j] = i;
      }
    }
  }
  for (long long int i = 2; i <= N; i++) {
    if (!prime[i]) primes.insert(i);
  }
}
vector<long long int> b;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m, i, j, k;
  cin >> n;
  vector<long long int> v(n);
  for (i = 0; i < n; i++) cin >> v[i];
  seive();
  long long int cc = -1;
  for (i = 0; i < n; i++) {
    vector<long long int> its;
    long long int num = v[i];
    long long int div = spf[num];
    while (num != 1) {
      num /= div;
      if (div == spf[num]) continue;
      its.push_back(div);
      div = spf[num];
    }
    bool f = true;
    for (j = 0; j < (long long int)its.size(); j++) {
      if (primes.count(its[j]))
        continue;
      else {
        f = false;
        break;
      }
    }
    if (f) {
      b.push_back(v[i]);
      for (j = 0; j < (long long int)its.size(); j++) primes.erase(its[j]);
    } else {
      cc = v[i];
      break;
    }
  }
  if (cc != -1) {
    for (i = cc + 1;; i++) {
      vector<long long int> its;
      long long int num = i;
      long long int div = spf[num];
      while (num != 1) {
        num /= div;
        if (div == spf[num]) continue;
        its.push_back(div);
        div = spf[num];
      }
      bool f = true;
      for (j = 0; j < (long long int)its.size(); j++) {
        if (primes.count(its[j]))
          continue;
        else {
          f = false;
          break;
        }
      }
      if (f) {
        b.push_back(i);
        for (j = 0; j < (long long int)its.size(); j++) primes.erase(its[j]);
        break;
      }
    }
  }
  long long int sz = b.size();
  while (sz < n) {
    b.push_back((*primes.begin()));
    primes.erase(primes.begin());
    sz++;
  }
  for (i = 0; i < n; i++) cout << b[i] << " ";
  cerr << '\n'
       << "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms"
       << '\n';
}
