#include <bits/stdc++.h>
using namespace std;
long long dx[] = {1, -1, 0, 0};
long long dy[] = {0, 0, 1, -1};
const int sz = 2e6 + 5, mod = 998244353;
long long t, n, m, k;
const int MAXN = 2e5 + 7;
const long long lim = 1e18;
const long long inf = 1e15;
vector<long long> Prime;
vector<bool> sie(sz, 1);
void sieve() {
  sie[0] = 0;
  sie[1] = 0;
  for (long long i = 2; i < sz; i++) {
    if (sie[i]) {
      for (long long j = i * i; j < sz; j += i) sie[j] = 0;
    }
  }
  for (long long i = 0; i < sz; i++) {
    if (sie[i]) Prime.push_back(i);
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  sieve();
  cin >> n;
  vector<long long> v(n);
  for (auto &i : v) cin >> i;
  map<long long, long long> track;
  vector<long long> ans;
  long long in = -1;
  for (int i = 0; i < n; i++) {
    long long a = v[i];
    bool flag = 0;
    vector<long long> pp;
    for (long long j = 2; j * j <= a; j++) {
      if (a % j == 0) {
        while (a % j == 0) {
          a /= j;
        }
        if (track.find(j) != track.end()) {
          flag = 1;
          break;
        } else
          track[j];
        pp.push_back(j);
      }
    }
    if (a != 1 && flag == 0) {
      if (track.find(a) != track.end()) {
        flag = 1;
      } else
        track[a];
    }
    if (flag) {
      for (auto j : pp) track.erase(j);
      for (long long j = v[i] + 1; j < sz; j++) {
        long long a = j;
        bool f = 1;
        vector<long long> arr;
        for (long long k = 2; k * k <= a; k++) {
          if (a % k == 0) {
            while (a % k == 0) {
              a /= k;
            }
            if (track.find(k) != track.end()) {
              f = 0;
              break;
            } else
              track[k];
            arr.push_back(k);
          }
        }
        if (a != 1 && f) {
          if (track.find(a) != track.end()) {
            f = 0;
          } else
            track[a];
        }
        if (f) {
          ans.push_back(j);
          break;
        } else {
          for (auto j : arr) track.erase(j);
        }
      }
      in = i + 1;
      break;
    }
    ans.push_back(v[i]);
  }
  if (in == -1) {
    for (auto i : ans) cout << i << " ";
    return 0;
  }
  int cnt = ans.size();
  int i = 0;
  while (cnt < n) {
    if (track.find(Prime[i]) == track.end()) {
      cnt++;
      ans.push_back(Prime[i]);
    }
    i++;
  }
  for (auto i : ans) cout << i << " ";
  return 0;
}
