#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
ostream& operator<<(ostream& out, const pair<A, B>& a) {
  return out << "(" << a.first << ", " << a.second << ")";
}
template <class A>
ostream& operator<<(ostream& out, const vector<A>& a) {
  out << "[";
  for (auto it = a.begin(); it != a.end(); ++it) {
    if (it != a.begin()) out << ", ";
    out << *it;
  }
  return out << "]";
}
const int INF = 1e9;
const long long INF64 = 1e18;
const int MOD = 1e9 + 7;
const long double PI = acosl(-1.0);
const long double EPS = 1e-9;
mt19937 rnd(time(NULL));
mt19937_64 rnd64(time(NULL));
const int N = 3 * 1000 * 1000 + 11;
int n;
int a[N];
bool isp[N];
int mind[N];
bool used[N];
set<int> pr;
bool read() {
  if (!(cin >> n)) return false;
  for (int i = 0; i < int(n); ++i) cin >> a[i];
  return true;
}
void precalc() {
  for (int i = 0; i < int(N); ++i) mind[i] = i;
  for (int i = 2; i < N; ++i) {
    if (!isp[i]) {
      pr.insert(i);
      for (long long j = i * 1ll * i; j < N; j += i) {
        isp[j] = true;
        mind[j] = min(mind[j], i);
      }
    }
  }
}
void add(int n, vector<int>& p, bool& ok) {
  p.clear();
  while (n > 1) {
    int j = mind[n];
    if (n % j == 0) {
      if (used[j]) ok = false;
      p.push_back(j);
    }
    while (n % j == 0) n /= j;
  }
}
void solve() {
  precalc();
  for (int i = 0; i < int(n); ++i) {
    vector<int> cur;
    bool ok = true;
    add(a[i], cur, ok);
    if (!ok) {
      int num = -1;
      vector<int> v;
      for (int first = int(a[i] + 1); first < int(N); ++first) {
        bool f = true;
        add(first, v, f);
        if (f) {
          num = first;
          break;
        }
      }
      assert(num != -1);
      a[i] = num;
      for (auto it : v) pr.erase(it);
      for (int j = int(i + 1); j < int(n); ++j) {
        a[j] = *pr.begin();
        pr.erase(pr.begin());
      }
      break;
    } else {
      for (auto it : cur) {
        used[it] = true;
        pr.erase(it);
      }
    }
  }
  for (int i = 0; i < int(n); ++i) cout << a[i] << " ";
  cout << endl;
}
int main() {
  cout << fixed << setprecision(10);
  cerr << fixed << setprecision(10);
  while (read()) {
    solve();
  }
}
