#include <bits/stdc++.h>
using namespace std;
int prime[7000000];
int maxx = 7000000;
void sieve() {
  prime[1] = 0;
  prime[2] = 2;
  for (int i = 4; i < maxx; i += 2) {
    prime[i] = 2;
  }
  for (int i = 3; i < maxx; i += 2) {
    if (prime[i] != 0) continue;
    prime[i] = i;
    for (int j = 2; j * i < maxx; j++) {
      if (prime[j * i] == 0) prime[j * i] = i;
    }
  }
}
void solve() {
  int n;
  cin >> n;
  int a[n], ind = -1;
  unordered_map<int, int> mp;
  sieve();
  int fl = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    int temp = a[i];
    vector<int> v;
    while (temp > 1) {
      int pr = prime[temp];
      if (mp[pr] != 0) {
        ind = i;
        fl = 1;
        break;
      } else {
        v.push_back(pr);
        while (temp % pr == 0) {
          temp /= pr;
        }
      }
    }
    if (fl == 1) break;
    for (int i = 0; i < (int)v.size(); i++) mp[v[i]] = 1;
  }
  if (ind == -1) {
    for (int i = 0; i < n; i++) cout << a[i] << " ";
  } else {
    for (int i = 0; i < ind; i++) {
      cout << a[i] << " ";
    }
    for (int j = a[ind] + 1; j < maxx; j++) {
      int temp = j;
      fl = 0;
      vector<int> v;
      while (temp > 1) {
        int pr = prime[temp];
        if (mp[pr] != 0) {
          fl = 1;
          break;
        } else {
          v.push_back(pr);
          while (temp % pr == 0) {
            temp /= pr;
          }
        }
      }
      if (fl == 0) {
        cout << j << " ";
        ind++;
        for (int i = 0; i < (int)v.size(); i++) {
          mp[v[i]] = 1;
        }
        break;
      }
    }
    int j = 2;
    while (ind < n) {
      if (mp[j] == 0 && prime[j] == j) {
        cout << j << " ";
        ind++;
      }
      j++;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
