#include <bits/stdc++.h>
using namespace std;
string str1;
map<string, long long> mp;
vector<long long> g;
vector<long long> dv[2000005];
long long ara[2000005], lw[2000005];
bool vis[2000005];
queue<long long> q;
void seive() {
  memset(vis, 0, sizeof vis);
  for (long long i = 2; i < 2000005; i++) {
    if (!vis[i]) {
      g.push_back(i);
      for (long long j = i; j < 2000005; j += i) {
        vis[j] = 1;
        if (j < 2 * 100005) dv[j].push_back(i);
      }
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m, k, x, a, j, b, i, l;
  seive();
  while (cin >> n) {
    for (i = 1; i <= n; i++) {
      cin >> ara[i];
    }
    memset(vis, 0, sizeof vis);
    bool flg = false;
    for (i = 1; i <= n; i++) {
      a = ara[i];
      for (j = 0; j < dv[a].size(); j++) {
        b = dv[a][j];
        if (vis[b]) {
          l = a + 1;
          for (l = l;; l++) {
            bool f = 1;
            for (k = 0; k < dv[l].size(); k++) {
              if (vis[dv[l][k]]) {
                f = 0;
                break;
              }
            }
            if (f) break;
          }
          ara[i] = l;
          for (k = 0; k < dv[l].size(); k++) {
            vis[dv[l][k]] = 1;
          }
          for (l = 0; l < g.size(); l++) {
            if (!vis[g[l]]) {
              q.push(g[l]);
            }
          }
          for (l = i + 1; l <= n; l++) {
            ara[l] = q.front();
            q.pop();
          }
          flg = true;
          break;
        }
      }
      for (j = 0; j < dv[a].size(); j++) {
        b = dv[a][j];
        vis[b] = 1;
      }
      if (flg) break;
    }
    for (i = 1; i <= n; i++) {
      cout << ara[i] << " ";
    }
    cout << endl;
    while (!q.empty()) q.pop();
  }
  return 0;
}
