#include <bits/stdc++.h>
using namespace std;
bool B[1400001];
int main() {
  int n, a, N = 2, X;
  scanf("%d", &n);
  bool F = false;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a);
    X = N;
    if (!F && a > X) X = a;
    while (B[X]) ++X;
    printf("%d ", X);
    if (X > a) F = true;
    for (int j = N; j * j <= X; ++j) {
      if (X % j) continue;
      while (X % j == 0) X /= j;
      if (!B[j])
        for (int t = j; t < 1400005; t += j) B[t] = true;
    }
    if (X != 1)
      for (int j = X; j < 1400005; j += X) B[j] = true;
    while (B[N]) ++N;
  }
}
