#include <bits/stdc++.h>
using namespace std;
int prime[10000000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  for (int i = 0; i < 10000000; i++) prime[i] = i;
  vector<int> v;
  for (int i = 2; i <= sqrt(10000000); i++) {
    if (prime[i] != i) continue;
    for (int j = i * i; j < 10000000; j += i) {
      if (prime[j] == j) prime[j] = i;
    }
  }
  for (int i = 2; i < 10000000; i++)
    if (prime[i] == i) v.push_back(i);
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int cnt[700008] = {0};
  for (int i = 0; i < 700008; i++) cnt[i] = 0;
  int f = 0;
  vector<int> ans;
  int i = 0;
  for (i = 0; i < n; i++) {
    int x = arr[i];
    while (x > 1) {
      int y = lower_bound(v.begin(), v.end(), prime[x]) - v.begin();
      if (cnt[y] > 0) {
        f = 1;
      }
      cnt[y]++;
      int p = prime[x];
      while (x % p == 0) x /= p;
    }
    if (f == 1)
      break;
    else
      ans.push_back(arr[i]);
  }
  if (i == n) {
    for (int i = 0; i < n; i++) cout << ans[i] << " ";
    return 0;
  }
  int y = arr[i];
  while (y > 1) {
    int c = lower_bound(v.begin(), v.end(), prime[y]) - v.begin();
    int p = prime[y];
    cnt[c]--;
    while (y % p == 0) y /= p;
  }
  int j = 1;
  for (j = 1;; j++) {
    y = arr[i] + j;
    int f = 0;
    while (y > 1) {
      int c = lower_bound(v.begin(), v.end(), prime[y]) - v.begin();
      int p = prime[y];
      if (cnt[c] > 0) {
        f = 1;
        break;
      }
      while (y % p == 0) y /= p;
    }
    if (f == 0) break;
  }
  y = arr[i] + j;
  while (y > 1) {
    int c = lower_bound(v.begin(), v.end(), prime[y]) - v.begin();
    int p = prime[y];
    cnt[c]++;
    while (y % p == 0) y /= p;
  }
  ans.push_back(arr[i] + j);
  i = 0;
  while (ans.size() < n) {
    if (cnt[i] == 0) ans.push_back(v[i]);
    i++;
  }
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
}
