#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int sieve_size = 5e6;
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int &x : a) cin >> x;
  vector<int> primes;
  vector<bool> sieve(sieve_size);
  for (int i = 2; i < int((sieve).size()); i++) {
    if (sieve[i]) continue;
    primes.push_back(i);
    for (int j = i + i; j < int((sieve).size()); j += i) {
      sieve[j] = true;
    }
  }
  auto get_decomp = [](int x) {
    vector<int> decomp;
    for (int j = 2; j * j <= x; j++) {
      if (x % j == 0) {
        decomp.push_back(j);
        x /= j;
        while (x % j == 0) x /= j;
      }
    }
    if (x != 1) decomp.push_back(x);
    return decomp;
  };
  set<int> occupied_primes;
  vector<int> b(n);
  bool a_coprime = true;
  for (int i = 0, primes_idx = 0; i < n; i++) {
    if (a_coprime) {
      vector<int> decomp = get_decomp(a[i]);
      for (int x : decomp) {
        if (occupied_primes.count(x)) {
          a_coprime = false;
          break;
        }
      }
      if (!a_coprime) {
        for (a[i]++;; a[i]++) {
          decomp = get_decomp(a[i]);
          bool ok = true;
          for (int x : decomp) {
            if (occupied_primes.count(x)) {
              ok = false;
              break;
            }
          }
          if (ok) break;
        }
      }
      for (int x : decomp) occupied_primes.insert(x);
      b[i] = a[i];
    } else {
      while (occupied_primes.count(primes[primes_idx])) primes_idx++;
      b[i] = primes[primes_idx++];
    }
  }
  for (int x : b) cout << x << ' ';
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int tcs = 1;
  for (int tc = 1; tc <= tcs; tc++) {
    solve();
  }
}
