#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
const int NMax = 2e3 + 5;
const ll inf_ll = 1e18 + 5;
const int inf_int = 1e9 + 5;
const int mod = 1e9 + 7;
using zint = ll;
bool cmp(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) {
    return a.second > b.second;
  }
  return a.first < b.first;
}
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> a(N + 1);
  vector<bool> notCoPrime(1e7 + 5, false);
  notCoPrime[1] = true;
  int idx = -1;
  for (int i = 1; i <= N; ++i) {
    cin >> a[i];
    if (notCoPrime[a[i]]) {
      idx = i - 1;
      break;
    }
    int aux = a[i];
    for (ll d = 2; d * d <= aux; ++d) {
      if (aux % d != 0) {
        continue;
      }
      while (aux % d == 0) {
        aux /= d;
      }
      if (notCoPrime[d]) {
        continue;
      }
      for (ll j = d; j <= 1e7; j += d) {
        notCoPrime[j] = true;
      }
    }
    if (aux != 1) {
      if (notCoPrime[aux]) {
        continue;
      }
      for (ll j = aux; j <= 1e7; j += aux) {
        notCoPrime[j] = true;
      }
    }
  }
  if (idx == -1) {
    for (int i = 1; i <= N; ++i) {
      cout << a[i] << ' ';
    }
    return 0;
  }
  for (int i = a[idx + 1] + 1; i <= 1e7; ++i) {
    if (notCoPrime[i]) {
      continue;
    }
    a[++idx] = i;
    int aux = i;
    for (ll d = 2; d * d <= aux; ++d) {
      if (aux % d != 0) {
        continue;
      }
      aux /= d;
      if (notCoPrime[d]) {
        continue;
      }
      for (ll j = d; j <= 1e7; j += d) {
        notCoPrime[j] = true;
      }
    }
    if (aux != 1) {
      if (notCoPrime[aux]) {
        continue;
      }
      for (ll j = aux; j <= 1e7; j += aux) {
        notCoPrime[j] = true;
      }
    }
    break;
  }
  if (idx < N) {
    for (int i = 2; i <= 1e7; ++i) {
      if (notCoPrime[i]) {
        continue;
      }
      a[++idx] = i;
      if (idx == N) {
        break;
      }
      for (int j = i; j <= 1e7; j += i) {
        notCoPrime[j] = true;
      }
    }
  }
  for (int i = 1; i <= N; ++i) {
    cout << a[i] << ' ';
  }
  return 0;
}
