#include <bits/stdc++.h>
using namespace std;
bitset<1500000> vis;
vector<int> primes;
void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < (int)n; i++) cin >> v[i];
  vis.reset();
  vector<int> ans(n);
  for (int i = 0; i < (int)n; i++) {
    bool ok = true;
    int x = v[i];
    vector<int> p;
    for (int j = 2; j * j <= x; j++) {
      if (x % j == 0) {
        if (vis[j]) {
          ok = false;
          break;
        } else
          p.push_back(j);
        while (x % j == 0) x /= j;
      }
    }
    if (ok && x > 1) {
      if (vis[x]) {
        ok = false;
      }
      p.push_back(x);
    }
    if (ok) {
      ans[i] = v[i];
      for (auto& val : p) {
        vis[val] = 1;
      }
    } else {
      bool found = false;
      int now = v[i] + 1;
      while (!found) {
        int num = now;
        p.clear();
        ok = true;
        for (int j = 2; j * j <= num; j++) {
          if (num % j == 0) {
            if (vis[j]) {
              ok = false;
              break;
            }
            p.push_back(j);
            while (num % j == 0) num /= j;
          }
        }
        if (ok && num > 1) {
          if (vis[num]) {
            ok = false;
          }
          p.push_back(num);
        }
        if (ok) {
          found = true;
          for (auto& val : p) {
            vis[val] = 1;
          }
        }
        if (!found) {
          now++;
        }
      }
      ans[i] = now;
      vector<int> aux;
      for (int j = 0; j < (int)primes.size(); j++) {
        if (vis[primes[j]]) continue;
        aux.push_back(primes[j]);
        if ((int)aux.size() > n - i) break;
      }
      for (int j = i + 1; j < n; j++) {
        ans[j] = aux[j - i - 1];
      }
      break;
    }
  }
  for (int i = 0; i < (int)n; i++) cout << ans[i] << " \n"[i == n - 1];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  for (int i = 2; i * i <= 1500000; i++) {
    if (!vis[i]) {
      for (int j = i * i; j <= 1500000; j += i) {
        vis[j] = 1;
      }
    }
  }
  for (int i = 2; i <= 1500000; i++) {
    if (!vis[i]) primes.push_back(i);
  }
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
