#include <bits/stdc++.h>
using namespace std;
const int maxprime = 5e6 + 10, up = sqrt(maxprime);
int prime[maxprime];
int used[maxprime];
inline void sieve() {
  for (int i = 0; i < maxprime; i++) prime[i] = i;
  for (int i = 2; i < maxprime; i += 2) prime[i] = 2;
  for (int i = 3; i <= up; i += 2) {
    if (prime[i] != i) continue;
    int lim = i * i;
    int add = 2 * i;
    for (int j = lim; j < maxprime; j += add) {
      if (prime[j] == j) prime[j] = i;
    }
  }
}
int n;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  sieve();
  cin >> n;
  int arr[n], ans[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  bool can = true;
  int lptr = 2;
  for (int i = 0; i < n; i++) {
    int temp = arr[i];
    int div;
    vector<int> seq;
    int here = -1;
    while (temp > 1 && can) {
      div = prime[temp];
      here = i;
      if (used[div] == 1) {
        can = false;
        break;
      }
      while (temp % div == 0) temp /= div;
      seq.push_back(div);
    }
    if (can) {
      for (auto u : seq) {
        int cur = u;
        while (cur < maxprime) {
          used[cur] = 1;
          cur += u;
        }
      }
      ans[i] = arr[i];
    } else if (here != i) {
      while (used[lptr] == 1) lptr++;
      ans[i] = lptr;
      int temp = lptr;
      int div;
      vector<int> seq;
      while (temp > 1) {
        div = prime[temp];
        while (temp % div == 0) temp /= div;
        seq.push_back(div);
      }
      for (auto u : seq) {
        int cur = u;
        while (cur < maxprime) {
          used[cur] = 1;
          cur += u;
        }
      }
    } else {
      int lptr = arr[i];
      while (used[lptr] == 1) lptr++;
      ans[i] = lptr;
      int temp = lptr;
      int div;
      vector<int> seq;
      while (temp > 1) {
        div = prime[temp];
        while (temp % div == 0) temp /= div;
        seq.push_back(div);
      }
      for (auto u : seq) {
        int cur = u;
        while (cur < maxprime) {
          used[cur] = 1;
          cur += u;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) cout << ans[i] << ' ';
  return 0;
}
