#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> SPF(10000001);
  for (int i = 1; i < 10000001; i++) SPF[i] = i;
  vector<int> P;
  set<int> Primes;
  for (int i = 2; i < 32000; i++) {
    if (SPF[i] == i)
      for (int j = 2 * i; j < 10000001; j += i)
        if (SPF[j] == j) SPF[j] = i;
  }
  for (int i = 2; i < 10000001; i++)
    if (SPF[i] == i) P.push_back(i), Primes.insert(i);
  bool skip = 0;
  vector<int> A(n);
  vector<int> B(n);
  for (int& x : A) cin >> x;
  for (int i = 0; i < n; i++) {
    if (skip) {
      int x = *Primes.begin();
      B[i] = x;
      Primes.erase(x);
    } else {
      set<int> fact;
      bool hasUsed = 0;
      int x = A[i];
      while (x != 1) {
        fact.insert(SPF[x]);
        if (!Primes.count(SPF[x])) hasUsed = 1;
        x /= SPF[x];
      }
      if (!hasUsed) {
        for (auto x : fact) Primes.erase(x);
        B[i] = A[i];
      } else {
        int y = *Primes.lower_bound(A[i]);
        for (int z = A[i] + 1; z <= y; z++) {
          set<int> fact;
          bool hasUsed = 0;
          int x = z;
          while (x != 1) {
            fact.insert(SPF[x]);
            if (!Primes.count(SPF[x])) hasUsed = 1;
            x /= SPF[x];
          }
          if (!hasUsed) {
            y = z;
            for (auto x : fact) Primes.erase(x);
            break;
          }
        }
        skip = 1;
        B[i] = y;
      }
    }
  }
  for (int i = 0; i < n; i++) cout << B[i] << " ";
}
