#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5, MOD = 11941, MAXN = 1e5, LG = 20, M = 1e6 + 5, P = 727,
          Sq = 100;
const long long inf = 1e18 + 10;
vector<int> pr[N];
int a[N], b[N];
bool mark[N], use[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 2; i < N; i++) {
    if (mark[i]) continue;
    for (int j = 2 * i; j < N; j += i) {
      mark[j] = 1;
      pr[j].push_back(i);
    }
    pr[i].push_back(i);
  }
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    bool sw = true;
    for (int j = 0; j < (int)pr[a[i]].size(); j++) {
      if (use[pr[a[i]][j]]) {
        sw = false;
        break;
      }
    }
    if (sw) {
      b[i] = a[i];
      for (int j = 0; j < (int)pr[a[i]].size(); j++) use[pr[a[i]][j]] = 1;
    } else {
      for (int j = a[i]; j < N; j++) {
        bool sw = true;
        for (int x = 0; x < (int)pr[j].size(); x++) {
          if (use[pr[j][x]]) {
            sw = false;
            break;
          }
        }
        if (sw) {
          for (int x = 0; x < (int)pr[j].size(); x++) use[pr[j][x]] = 1;
          b[i] = j;
          break;
        }
      }
      for (int x = 1; x <= i; x++) {
        cout << b[x] << " ";
      }
      int tmp = n - i;
      for (int j = 2; j < N; j++) {
        if (!mark[j] && !use[j] && tmp) {
          cout << j << " ";
          tmp--;
        }
      }
      return 0;
    }
  }
  for (int i = 1; i <= n; i++) cout << b[i] << " ";
  return 0;
}
