#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e7 + 10;
const int tam = 1e5 + 10;
set<int> sol;
int divs[maxn];
int arr[tam];
int b[tam];
void sieve() {
  for (int i = 2; i < maxn; i += 2) divs[i] = 2;
  for (int i = 3; i < maxn; i += 2)
    if (!divs[i]) {
      divs[i] = i;
      if (1ll * i * i >= maxn) continue;
      for (int j = i * i; j < maxn; j += i) divs[j] = i;
    }
}
bool possible(int n) {
  while (n != 1) {
    int p = divs[n];
    if (sol.count(p)) return false;
    while (n % p == 0) n /= p;
  }
  return true;
}
void act(int n) {
  while (n != 1) {
    int p = divs[n];
    sol.insert(p);
    while (n % p == 0) n /= p;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  sieve();
  for (int i = 0; i < n; ++i) cin >> arr[i];
  for (int i = 0; i < n; ++i) {
    if (possible(arr[i])) {
      b[i] = arr[i];
      act(arr[i]);
    } else {
      int num = arr[i] + 1;
      while (!possible(num)) num++;
      act(num);
      b[i] = num;
      i++;
      num = 2;
      while (i < n) {
        while (divs[num] != num || sol.count(num) != 0) num++;
        b[i] = num;
        num++;
        ++i;
      }
    }
  }
  for (int i = 0; i < n; ++i) cout << b[i] << " ";
  cout << '\n';
  return 0;
}
