#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 9;
const int MAXN = 2e6 + 5;
int n, l = 1, x, p;
bool vis[MAXN];
vector<int> prime[MAXN];
void Euler_sieve(int n) {
  for (int i = 2; i < n; ++i)
    if (!vis[i])
      for (int j = i; j < n; j += i) prime[j].push_back(i), vis[j] = 1;
  memset(vis, 0, sizeof vis);
}
bool judge(int n) {
  for (int i = 0; i <= int(prime[n].size() - 1); i++)
    if (vis[prime[n][i]]) return false;
  return true;
}
int main() {
  Euler_sieve(MAXN);
  cin >> n;
  while (n--) {
    cin >> x;
    if (p) {
      while (!judge(++l))
        ;
      for (int i = 0; i <= int(prime[l].size() - 1); i++) vis[prime[l][i]] = 1;
      cout << l << " ";
    } else {
      if (judge(x)) {
        for (int i = 0; i <= int(prime[x].size() - 1); i++)
          vis[prime[x][i]] = 1;
        cout << x << " ";
      } else {
        p = 1;
        while (!judge(++x))
          ;
        for (int i = 0; i <= int(prime[x].size() - 1); i++)
          vis[prime[x][i]] = 1;
        cout << x << " ";
      }
    }
  }
  return 0;
}
