#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000000;
const long double pi = 4 * atan(1.0);
long long MOD = 1e9 + 7, INF = 1e18;
int n, z;
bool d[maxn], pr[maxn];
vector<char> prime(maxn + 1, true);
vector<int> vpr;
void fil(int a) {
  for (int i = a; i < maxn; i += a) d[i] = 1;
}
void obr(int a) {
  int z = a;
  for (int i = 0; vpr[i] * vpr[i] <= z; i++) {
    if (a % vpr[i] == 0) fil(vpr[i]);
    while (z % vpr[i] == 0) z /= vpr[i];
  }
  if (z > 1) fil(z);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  for (int i = 0; i < maxn; i++) d[i] = 0;
  prime[0] = prime[1] = false;
  for (int i = 2; i <= maxn; ++i)
    if (prime[i])
      if (i * 1ll * i <= maxn)
        for (int j = i * i; j <= maxn; j += i) prime[j] = false;
  for (int i = 2; i <= maxn; i++)
    if (prime[i]) vpr.push_back(i);
  bool uj = 0;
  int ty;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> z;
    int vy = z;
    if (!uj) ty = z;
    while (d[ty] == 1) ty++;
    cout << ty << ' ';
    obr(ty);
    if (z < ty && uj == 0) {
      uj = 1;
      ty = 2;
    }
  }
}
