#include <bits/stdc++.h>
using namespace std;
const int nmax = (int)4e6;
vector<int> check;
vector<int> prime;
void sol() {
  check.assign(nmax + 1, 0);
  prime.assign(nmax + 1, 0);
  for (int i = 2; i <= nmax; i++)
    if (!prime[i]) {
      prime[i] = i;
      for (int j = i + i; j <= nmax; j += i)
        if (!prime[j]) prime[j] = i;
    }
}
void prod(int q1) {
  while (q1 > 1) {
    int q2 = prime[q1];
    assert(q2);
    if (!check[q2])
      for (int q3 = q2; q3 <= nmax; q3 += q2) check[q3] = 1;
    q1 /= q2;
  }
}
int main() {
  sol();
  int n;
  vector<int> a;
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int finish = n;
  for (int i = 0; i < n; i++)
    if (check[a[i]] == 0)
      prod(a[i]);
    else {
      finish = i;
      break;
    }
  if (finish == n) {
    for (int i = 0; i < n; i++) cout << a[i] << ' ';
    return 0;
  }
  for (int i = a[finish] + 1; 1; i++) {
    if (check[i]) continue;
    a[finish] = i;
    prod(i);
    finish++;
    break;
  }
  int q = 2;
  for (int i = finish; i < n; i++) {
    while (check[q]) q++;
    prod(q);
    a[i] = q;
  }
  for (int i = 0; i < n; i++) cout << a[i] << ' ';
}
