#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 2;
bool isPrime[maxn];
vector<int> primeNumbers;
int smallestPrimeDiv[maxn];
const int maxn2 = 1e5 + 2;
int a[maxn2];
int b[maxn2];
bool primeUsed[maxn];
void sieve(int n) {
  for (int i = 1; i <= n; ++i) {
    isPrime[i] = 1;
    smallestPrimeDiv[i] = i;
  }
  for (int i = 2; i * i <= n; ++i) {
    if (isPrime[i]) {
      for (int j = i * i; j <= n; j += i) {
        isPrime[j] = 0;
        smallestPrimeDiv[j] = i;
      }
    }
  }
  for (int i = 2; i < n; ++i) {
    if (isPrime[i]) primeNumbers.push_back(i);
  }
}
set<int> primeFactorsOf(int x) {
  set<int> ans;
  while (x > 1 && (x % smallestPrimeDiv[x] == 0)) {
    ans.insert(smallestPrimeDiv[x]);
    x /= smallestPrimeDiv[x];
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  sieve(maxn - 2);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  int i;
  for (i = 0; i < n; ++i) {
    set<int> pf = primeFactorsOf(a[i]);
    bool pos = 1;
    for (int pi : pf) {
      if (primeUsed[pi]) {
        pos = 0;
        break;
      }
    }
    if (!pos)
      break;
    else {
      for (int pi : pf) {
        primeUsed[pi] = 1;
      }
      b[i] = a[i];
    }
  }
  if (i < n) {
    int x = a[i];
    while (1) {
      x++;
      set<int> pf = primeFactorsOf(x);
      bool pos = 1;
      for (int pi : pf) {
        if (primeUsed[pi]) {
          pos = 0;
          break;
        }
      }
      if (!pos) continue;
      b[i] = x;
      for (int pi : pf) {
        primeUsed[pi] = 1;
      }
      break;
    }
  }
  i++;
  for (int j = 0; i < n; ++i) {
    while (primeUsed[primeNumbers[j]]) j++;
    b[i] = primeNumbers[j];
    primeUsed[primeNumbers[j]]++;
  }
  for (int i = 0; i < n; ++i) cout << b[i] << " ";
  cout << "\n";
  return 0;
}
