#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 9;
const int CMAX = 5e6 + 100;
bool isprime[CMAX];
int sml[CMAX], cnt[CMAX];
vector<int> primes;
int main() {
  memset(isprime, 1, sizeof(isprime));
  memset(sml, 0, sizeof(sml));
  memset(cnt, 0, sizeof(cnt));
  sml[1] = 1;
  for (int i = 2; i < CMAX; i++) {
    if (!isprime[i]) continue;
    primes.push_back(i);
    sml[i] = i;
    for (int j = i + i; j < CMAX; j += i) {
      if (sml[j] == 0) sml[j] = i;
      isprime[j] = 0;
    }
  }
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  int i;
  for (i = 0; i < n; i++) {
    int c = arr[i];
    bool brk = false;
    while (c > 1) {
      if (cnt[sml[c]] || cnt[c] != 0) {
        brk = true;
        break;
      }
      c /= sml[c];
    }
    if (brk) break;
    c = arr[i];
    while (c > 1) {
      cnt[c]++;
      cnt[sml[c]]++;
      c /= sml[c];
    }
  }
  int j;
  int req = i < n ? arr[i] + 1 : 0;
  if (i < n)
    while (1) {
      bool ok = true;
      int t = req;
      while (t > 1) {
        if (cnt[t] > 0 || cnt[sml[t]] > 0) {
          ok = false;
          break;
        }
        t /= sml[t];
      }
      if (ok) {
        arr[i] = req;
        t = req;
        while (t > 1) {
          cnt[t]++;
          cnt[sml[t]]++;
          t /= sml[t];
        }
        break;
      } else
        req++;
    }
  j = 0;
  for (i = i + 1; i < n; i++) {
    while (1) {
      if (cnt[primes[j]] == 0) {
        arr[i] = primes[j];
        j++;
        break;
      }
      j++;
    }
  }
  for (int i = 0; i < arr.size(); i++) {
    cout << arr[i] << " ";
  }
  return 0;
}
