#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 5;
bool vis[maxn], vis1[maxn], vis2[maxn];
int base[maxn];
void ff(int x) {
  while (x > 1) {
    int b = base[x];
    while (x % b == 0) x /= b;
    int y = b;
    while (y <= maxn) {
      vis1[y] = 1;
      y += b;
    }
  }
}
int main() {
  int n, a[100005];
  for (int i = 0; i <= maxn; i++) base[i] = 0;
  for (int i = 2; i <= maxn; i++) {
    if (!base[i]) {
      base[i] = i;
      for (int j = i + i; j <= maxn; j += i)
        if (!base[j]) base[j] = i;
    }
  }
  while (~scanf("%d", &n)) {
    for (int i = 0; i <= maxn; i++) vis1[i] = 0;
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    int flag = 0;
    int y = 2;
    for (int i = 0; i < n; i++) {
      if (flag == 1) {
        while (vis1[y]) y++;
        ff(y);
        a[i] = y;
        continue;
      }
      int x = a[i];
      if (!vis1[x]) {
        ff(x);
      } else {
        int y = x + 1;
        while (vis1[y]) y++;
        ff(y);
        a[i] = y;
        flag = 1;
      }
    }
    for (int i = 0; i < n; i++) printf("%d%c", a[i], i == n - 1 ? '\n' : ' ');
  }
  return 0;
}
