#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9;
const double PI = 2 * acos(0.0);
const double eps = 1e-7;
int dx[] = {1, 0, 0, -1, -1, -1, 1, 1};
int dy[] = {0, 1, -1, 1, 1, -1, 1, -1};
const int MOD = 1e9 + 7;
set<int> pr;
int prime[10000001];
void sieve(int n) {
  prime[0] = prime[1] = 1;
  for (int i = 2; i * i <= n; i++)
    if (prime[i] == 0)
      for (int j = 2 * i; j <= n; j += i) prime[j] = 1;
  for (int i = 0; i < n + 1; i++)
    if (prime[i] == 0) pr.insert(i);
}
void REMOVE(set<int> S) {
  for (auto i : S) pr.erase(i);
  return;
}
pair<bool, set<int> > fact(int temp) {
  set<int> S;
  bool valid = 1;
  for (long long i = 2; i * i <= temp; ++i) {
    bool findd = 0;
    while (temp % i == 0) findd = 1, S.insert(i), temp /= i;
    if (findd && pr.find(i) == pr.end()) {
      valid = 0;
      break;
    }
  }
  if (temp > 1)
    if (pr.find(temp) == pr.end())
      valid = 0;
    else
      S.insert(temp);
  return {valid, S};
}
int main() {
  sieve(10000000);
  int a[1000000];
  set<int> S;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int j = 0; j < n; j++) {
    pair<bool, set<int> > ret = fact(a[j]);
    bool valid = ret.first;
    set<int> S = ret.second;
    if (valid) {
      REMOVE(S);
      cout << a[j] << " ";
    } else {
      int last = a[j];
      while (1) {
        pair<bool, set<int> > ret = fact(++last);
        if (ret.first) {
          REMOVE(ret.second);
          cout << last << " ";
          break;
        }
      }
      int cnt = n - j - 1;
      for (auto l : pr) {
        if (cnt == 0) break;
        cout << l << " ";
        cnt--;
      }
      return 0;
    }
  }
}
