#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 5, M = 1e5 + 5;
set<int> primes;
int vis[N], A[N], v[N], sp[N];
vector<int> B, aux;
void sieve() {
  int cnt = 0;
  for (int i = 2; i < N; ++i) {
    if (!vis[i]) {
      sp[i] = i;
      cnt++;
      primes.insert(i);
      for (int j = 2 * i; j < N; j += i) {
        if (!vis[j]) {
          vis[j] = 1;
          sp[j] = i;
        }
      }
    }
  }
}
int main() {
  int n, fl = 0, one = 0, st = 0;
  cin >> n;
  sieve();
  for (int i = 1; i <= n; ++i) {
    cin >> A[i];
    int tmp = A[i];
    vector<int> de;
    if (!fl) {
      while (tmp > 1) {
        int di = sp[tmp];
        if (v[di]) break;
        v[di] = 1;
        de.push_back(di);
        primes.erase(di);
        while (tmp % di == 0) tmp /= di;
      }
    }
    if (fl) {
      B.push_back(aux[st++]);
    } else {
      if (tmp != 1) {
        fl = 1;
        int pe = A[i] + 1;
        for (auto u : de) {
          v[u] = 0;
          primes.insert(u);
        }
        while (1) {
          tmp = pe;
          vector<int> pr;
          while (tmp > 1) {
            int di = sp[tmp];
            if (v[di]) break;
            v[di] = 1;
            pr.push_back(di);
            while (tmp % di == 0) tmp /= di;
          }
          if (tmp == 1) {
            for (auto u : pr) primes.erase(u);
            B.push_back(pe);
            break;
          } else {
            pe++;
            for (auto u : pr) v[u] = 0;
            pr.clear();
          }
        }
        if (!one) {
          one = 1;
          for (auto u : primes) aux.push_back(u);
        }
      } else
        B.push_back(A[i]);
    }
  }
  for (auto u : B) printf("%d ", u);
  printf("\n");
  return 0;
}
