#include <bits/stdc++.h>
using namespace std;
const int N = 2e7 + 10;
int n, a, p[N], mx = 1, ans[N], cgd, tot;
bool pri[N], used[N];
inline int read() {
  char ch = getchar();
  int x = 0, t = 1;
  while (ch < '0' && ch > '9') {
    if (ch == '-') t = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * t;
}
inline void upd() {
  while (used[mx]) {
    mx++;
  }
}
inline void pre() {
  for (int i = 2; i < N; i++) {
    pri[i] = true;
    used[i] = false;
  }
  for (int i = 2; i < N; i++) {
    if (pri[i]) {
      p[++tot] = i;
      if ((long long)i * i >= N) continue;
      for (int j = i * i; j < N; j += i) {
        pri[j] = false;
      }
    }
  }
}
inline bool jud(int x) {
  for (int i = 1; p[i] <= x && x != 1; i++) {
    if (x % p[i] == 0) {
      if (used[i]) {
        return false;
      }
      while (x % p[i] == 0) x /= p[i];
    }
  }
  return true;
}
inline void insert(int x, int tag) {
  int ori = x;
  if (cgd == 0) {
    for (int i = 1; p[i] <= x; i++) {
      if (x % p[i] == 0) {
        if (used[i]) {
          cgd = 1;
          break;
        }
      }
    }
    if (cgd == 1) {
      int now = ori + 1;
      while (!jud(now)) now++;
      ans[tag] = now;
      for (int i = 1; p[i] <= now && now != 1; i++) {
        if (now % p[i] == 0) {
          used[i] = true;
          while (now % p[i] == 0) now /= p[i];
        }
      }
    } else {
      for (int i = 1; p[i] <= x && x != 1; i++) {
        if (x % p[i] == 0) {
          used[i] = true;
          while (x % p[i] == 0) x /= p[i];
        }
      }
      ans[tag] = ori;
    }
    upd();
  } else {
    upd();
    ans[tag] = p[mx];
    used[mx] = true;
  }
}
int main() {
  pre();
  n = read();
  for (int i = 1; i <= n; i++) {
    insert(read(), i);
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
