#include <bits/stdc++.h>
using namespace std;
int Array[100005], SPF[1500005], B[100005];
bool Primes[1500005];
void Sieve() {
  int i, j;
  for (i = 2; i <= 1500000; ++i) {
    if (SPF[i] != 0) continue;
    j = 2;
    SPF[i] = i;
    while (i * j <= 1500000) {
      if (SPF[i * j] == 0) SPF[i * j] = i;
      ++j;
    }
  }
}
int main() {
  int N, i, y;
  bool Check, flag;
  scanf("%d", &N);
  Sieve();
  int x, index = N + 1;
  fill(Primes, Primes + 1300001, false);
  for (i = 1; i <= N; ++i) {
    scanf("%d", Array + i);
    x = Array[i];
    Check = flag = false;
    while (index > N && x > 1) {
      Check = true;
      y = SPF[x];
      if (Primes[y] == true) {
        index = i - 1;
        flag = true;
      }
      x /= y;
    }
    if (Check == true && flag == false) {
      x = Array[i];
      while (x > 1) {
        y = SPF[x];
        Primes[y] = true;
        x /= y;
      }
    }
  }
  if (index == N + 1) index = N;
  for (i = 1; i <= index; ++i) B[i] = Array[i];
  if (index == N) {
    for (i = 1; i <= N; ++i) printf("%d ", B[i]);
    puts("");
    return 0;
  }
  i = Array[index + 1] + 1;
  while (true) {
    x = i;
    while (x > 1) {
      y = SPF[x];
      if (Primes[y] == true) break;
      x /= y;
    }
    if (x == 1) {
      B[index + 1] = i;
      x = i;
      while (x > 1) {
        y = SPF[x];
        Primes[y] = true;
        x /= y;
      }
      break;
    }
    ++i;
  }
  i = index + 2;
  int j = 2;
  while (i <= N) {
    x = j;
    while (x > 1) {
      y = SPF[x];
      if (Primes[y] == true) break;
      x /= y;
    }
    if (x == 1) {
      B[i++] = j;
      x = j;
      while (x > 1) {
        y = SPF[x];
        Primes[y] = true;
        x /= y;
      }
    }
    if (j == 2)
      ++j;
    else
      j += 2;
  }
  for (i = 1; i <= N; ++i) printf("%d ", B[i]);
  puts("");
  return 0;
}
