#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e7;
long long prime[maxn];
set<long long> st;
vector<long long> v;
void pre() {
  prime[0] = prime[1] = 1;
  for (long long i = 2; i * i < maxn; i++) {
    if (!prime[i]) {
      for (long long j = i * i; j < maxn; j += i) prime[j] = 1;
    }
  }
  for (long long i = 2; i < maxn; i++)
    if (!prime[i]) {
      st.insert(i);
      v.push_back(i);
    }
}
int main() {
  pre();
  int n;
  cin >> n;
  long long arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long brr[n];
  int idx = n;
  for (int i = 0; i < n; i++) {
    vector<long long> pd;
    long long z = arr[i] - 1;
    bool flag = true;
    while (flag) {
      flag = false;
      pd.clear();
      long long x = ++z;
      for (int j = 0; (j < v.size()) && (v[j] * v[j] <= x); j++) {
        bool flag = false;
        while (x % v[j] == 0) {
          flag = true;
          x /= v[j];
        }
        if (flag) {
          pd.push_back(v[j]);
        }
      }
      if (x != 1) pd.push_back(x);
      for (int j = 0; j < pd.size(); j++) {
        if (prime[pd[j]] == 2) {
          flag = true;
          break;
        }
      }
    }
    brr[i] = z;
    for (int j = 0; j < pd.size(); j++) {
      prime[pd[j]] = 2;
      st.erase(pd[j]);
    }
    idx = i;
    if (z > arr[i]) break;
  }
  auto it = st.begin();
  for (int j = idx + 1; j < n; j++) {
    brr[j] = *it;
    it++;
  }
  for (int i = 0; i < n; i++) cout << brr[i] << " ";
  cout << endl;
}
