#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long modpow(long long x, long long y, long long m) {
  long long z = 1;
  while (y) {
    if (y & 1) z = (z * x) % m;
    x = (x * x) % m;
    y >>= 1;
  }
  return z;
}
int egcd(int a, int b, int& x, int& y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  int x1, y1;
  int gcd = egcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return gcd;
}
string z[2] = {"NO", "YES"};
long long modinv(long long x, long long mod) { return modpow(x, mod - 2, mod); }
vector<int> pri(1.5e6 + 1), r;
vector<bool> done(1.5e6 + 1);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  int i, j, k, n, m;
  string s;
  while (t--) {
    for (i = 2; i * i <= 1.5e6; ++i) {
      if (pri[i]) continue;
      pri[i] = i;
      for (j = 2 * i; j <= 1.5e6; j += i)
        if (!pri[j]) pri[j] = i;
    }
    k = 1;
    for (i = 2; i <= 1.5e6; ++i) {
      if (!pri[i]) pri[i] = i;
      if (pri[i] == i) r.push_back(i);
    }
    cin >> n;
    vector<int> a(n);
    for (i = 0; i < n; ++i) cin >> a[i];
    cout << a[0] << " ";
    j = a[0];
    set<int> fc;
    for (i = 2; i < 1.5e6 + 1; ++i) fc.insert(i);
    while (j > 1) {
      if (fc.count(pri[j])) {
        for (k = pri[j]; k <= 1.5e6; k += pri[j]) fc.erase(k);
        done[pri[j]] = 1;
      }
      j /= pri[j];
    }
    bool as = 1;
    for (i = 1; i < n; ++i) {
      j = 2;
      if (as) j = a[i];
      auto x = fc.lower_bound(j);
      cout << *x << " ";
      if (*x != a[i]) as = 0;
      k = *x;
      while (k > 1) {
        if (!done[pri[k]]) {
          for (int p = pri[k]; p <= 1.5e6; p += pri[k]) fc.erase(p);
          done[pri[k]] = 1;
        }
        k /= pri[k];
      }
    }
  }
  return 0;
}
