#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  const int maxn = 1e6 + 5e5;
  vector<int> pr(maxn);
  iota(pr.begin(), pr.end(), 0);
  for (long long i = 2; i < maxn; ++i)
    if (pr[i] == i)
      for (long long j = i * i; j < maxn; j += i) pr[j] = i;
  vector<bool> good(maxn, true);
  good[0] = good[1] = false;
  auto fill = [&](int x) {
    while (x > 1) {
      int p = pr[x];
      while (x % p == 0) x /= p;
      if (good[p])
        for (int x = p; x < maxn; x += p) good[x] = false;
    }
  };
  bool ok = true;
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (!ok) continue;
    if (good[x]) {
      cout << x << " \n"[i + 1 == n];
      fill(x);
    } else {
      ok = false;
      while (!good[x]) ++x;
      cout << x << " \n"[i + 1 == n];
      fill(x);
      for (int j = i + 1, p = 2; j < n; ++j) {
        while (!good[p]) ++p;
        cout << p << " \n"[j + 1 == n];
        fill(p);
      }
    }
  }
  return 0;
}
