#include <bits/stdc++.h>
using namespace std;
const int MAX = 1.3e6 + 1000;
int P[MAX];
void sieve() {
  for (int i = 2; i < MAX; i += 2) P[i] = 2;
  for (int i = 3; i < MAX; i += 2) {
    if (!P[i]) {
      P[i] = i;
      if (1ll * i * i < MAX)
        for (int j = i * i; j < MAX; j += 2 * i)
          if (!P[j]) P[j] = i;
    }
  }
}
set<int> usd;
int a[MAX / 10];
vector<int> f;
void fact(int v) {
  f.clear();
  while (P[v]) {
    f.emplace_back(P[v]);
    int ax = P[v];
    while (v % ax == 0) v /= ax;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  sieve();
  for (int i = (2); i <= (MAX - 1); ++i) usd.insert(i);
  for (int i = (1); i <= (n); ++i) cin >> a[i];
  bool eq = 1;
  for (int i = (1); i <= (n); ++i) {
    int ans = *usd.lower_bound(a[i]);
    if (!eq) ans = *usd.begin();
    if (ans > a[i]) eq = 0;
    cout << ans << ' ';
    fact(ans);
    for (auto p : (f)) {
      if (usd.find(p) != usd.end())
        for (int i = p; i < MAX; i += p) usd.erase(i);
    }
  }
  return 0;
}
