#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000009;
const long long INF = 1e9 + 5;
const double eps = 1e-7;
const double PI = acos(-1.0);
inline void debug_vi(vector<int> a) {
  for (long long i = (long long)(0); i < (long long)(a.size()); i++)
    cout << a[i] << " ";
}
inline void debug_vll(vector<long long> a) {
  for (long long i = (long long)(0); i < (long long)(a.size()); i++)
    cout << a[i] << " ";
}
inline void print_case(int tn) { cout << "Case #" << tn << ": "; }
template <typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using maxpq = priority_queue<T>;
long long _sieve_size;
bitset<10000010> bs;
vector<int> primes;
vector<int> primeFactors(long long N) {
  vector<int> factors;
  long long PF_idx = 0, PF = primes[PF_idx];
  while (PF * PF <= N) {
    int cnt = 0;
    while (N % PF == 0) {
      N /= PF;
      cnt++;
    }
    if (cnt) factors.push_back(PF);
    PF = primes[++PF_idx];
  }
  if (N != 1) factors.push_back(N);
  return factors;
}
void sieve(long long upperbound) {
  _sieve_size = upperbound + 1;
  bs.set();
  bs[0] = bs[1] = 0;
  for (long long i = 2; i <= _sieve_size; i++)
    if (bs[i]) {
      for (long long j = i * i; j <= _sieve_size; j += i) bs[j] = 0;
      primes.push_back((int)i);
    }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  sieve(1e7 + 5);
  set<int> s((primes).begin(), (primes).end());
  int n;
  cin >> n;
  vector<int> arr(n);
  for (long long i = (long long)(0); i < (long long)(n); i++) cin >> arr[i];
  vector<int> res(n);
  bool g = false;
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    if (g) {
      res[i] = *s.begin();
      s.erase(s.begin());
    } else {
      int val = arr[i];
      while (true) {
        auto pf = primeFactors(val);
        bool cool = true;
        for (int p : pf) {
          if (!s.count(p)) cool = false;
        }
        if (cool) {
          res[i] = val;
          for (int p : pf) {
            s.erase(p);
          }
          if (val > arr[i]) g = true;
          break;
        }
        val++;
      }
    }
  }
  for (long long i = (long long)(0); i < (long long)(n); i++)
    cout << res[i] << " ";
  return 0;
}
