#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
const int N = 1500010, M = 1500000;
inline int read() {
  int s = 0, w = 1;
  register char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
  return s * w;
}
int n, a[N], b[N];
set<int> Q;
signed main() {
  n = read();
  for (register int i = 1; i <= n; i++) a[i] = read();
  for (register int i = 2; i <= M; i++) Q.insert(i);
  int flg = 0;
  for (register int i = 1; i <= n; i++) {
    int x;
    if (flg)
      x = (*Q.begin());
    else
      x = (*Q.lower_bound(a[i]));
    if (x > a[i]) flg = 1;
    b[i] = x;
    int X = x;
    for (register int j = 2; j * j <= X; j++) {
      if (X % j) continue;
      while (X % j == 0) X /= j;
      for (register int k = j; k <= M; k += j)
        if (Q.count(k)) Q.erase(Q.find(k));
    }
    if (X > 1) {
      for (register int j = X; j <= M; j += X) {
        if (Q.count(j)) Q.erase(Q.find(j));
      }
    }
  }
  for (register int i = 1; i <= n; i++) printf("%d ", b[i]);
  puts("");
  return 0;
}
