#include <bits/stdc++.h>
using namespace std;
long long MOD_EXPO(long long b, long long p, long long m) {
  if (p == 0) return 1;
  long long ret = MOD_EXPO(b, p / 2, m) % m;
  ret = (ret * ret) % m;
  return ((p & 1) ? (ret * b) % m : ret % m);
}
long long POWER(long long N, long long K) {
  long long i, ans = 1;
  for (i = 1; i <= K; i++) ans *= N;
  return ans;
}
int SET(int N, int pos) { return (N | (1 << pos)); }
int RESET(int N, int pos) { return (N & !(1 << pos)); }
bool CHECK(int N, int pos) { return (N & (1 << pos)); }
int dx4[] = {1, -1, 0, 0};
int dy4[] = {0, 0, 1, -1};
int dx6[] = {0, 0, 1, -1, 0, 0};
int dy6[] = {1, -1, 0, 0, 0, 0};
int dz6[] = {0, 0, 0, 0, 1, -1};
int dx8[] = {1, -1, 0, 0, -1, 1, -1, 1};
int dy8[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dkx8[] = {-1, 1, -1, 1, -2, -2, 2, 2};
int dky8[] = {2, 2, -2, -2, 1, -1, 1, -1};
int tc = 1;
const double eps = 1e-9;
const double pi = acos(-1.0);
const long long int mn = 1e5;
const long long int mx = 2e6;
const long long int mod = 1e9 + 7;
int n;
int a[mn + 5];
int b[mn + 5];
set<int> primes;
bool is_greater;
set<int>::iterator it;
int next_number[mx + 5];
int is_composite[mx + 5];
void sieve(void) {
  int i, j;
  next_number[1] = 1;
  for (i = 2; i <= mx; i++) {
    if (!is_composite[i]) {
      next_number[i] = i;
      primes.insert(i);
      for (j = i + i; j <= mx; j += i) {
        next_number[j] = i;
        is_composite[j] = true;
      }
    }
  }
  return;
}
int get_greater_number(int x) {
  int i, k, limit, number;
  vector<int> primes_to_remove;
  number = x;
  limit = *primes.lower_bound(x);
  for (i = x + 1; i <= limit; i++) {
    number = i;
    primes_to_remove.clear();
    while (number > 1) {
      k = next_number[number];
      primes_to_remove.push_back(k);
      if (primes.find(k) == primes.end()) break;
      while (number % k == 0) {
        number /= k;
      }
    }
    if (number == 1) {
      number = i;
      break;
    }
  }
  for (i = 0; i < primes_to_remove.size(); i++) {
    primes.erase(primes_to_remove[i]);
  }
  return number;
}
int get_any_number(void) {
  int number;
  number = *primes.begin();
  primes.erase(primes.begin());
  return number;
}
int get_appropriate_number(int x) {
  int i, k, temp;
  vector<int> primes_to_add;
  bool is_update_required;
  temp = x;
  is_update_required = false;
  while (x > 1) {
    k = next_number[x];
    if (primes.find(k) == primes.end()) {
      is_update_required = true;
    } else {
      primes.erase(k);
      primes_to_add.push_back(k);
    }
    while (x % k == 0) {
      x /= k;
    }
  }
  x = temp;
  if (is_update_required || is_greater) {
    for (i = 0; i < primes_to_add.size(); i++) {
      primes.insert(primes_to_add[i]);
    }
    if (is_greater) {
      x = get_any_number();
    } else {
      is_greater = true;
      x = get_greater_number(x);
    }
  }
  return x;
}
int main() {
  int i;
  sieve();
  cin >> n;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  is_greater = false;
  for (i = 1; i <= n; i++) {
    b[i] = get_appropriate_number(a[i]);
  }
  for (i = 1; i <= n; i++) {
    printf("%d ", b[i]);
  }
  printf("\n");
  return 0;
}
