#include <bits/stdc++.h>
using namespace std;
bool c[2000000 + 1];
int prim[2000000 + 1], vf, d[100005];
void ciur() {
  long long i, j;
  prim[1] = 2;
  vf = 1;
  for (i = 4; i <= 2000000; i = i + 2) c[i] = 1;
  for (i = 3; i <= 2000000; i = i + 2) {
    if (c[i] == 0) {
      prim[++vf] = i;
      for (j = i * i; j <= 2000000; j = j + i) c[j] = 1;
    }
  }
}
bool desc(int x) {
  int div = 2;
  d[0] = 0;
  while (x > div * div) {
    if (x % div == 0) {
      while (x % div == 0) x /= div;
      if (c[div] == 0)
        c[div] = 1;
      else {
        while (d[0] > 0) {
          c[d[d[0]]] = 0;
          d[0]--;
        }
        return false;
      }
      d[++d[0]] = div;
    }
    div++;
  }
  if (x % div == 0 && x > div) x /= div;
  if (c[x] == 0 || x == 1)
    c[x] = 1;
  else {
    while (d[0] > 0) {
      c[d[d[0]]] = 0;
      d[0]--;
    }
    return false;
  }
  return true;
}
int main() {
  int tolate = 0;
  int n, ind = 1, i, x;
  long long y;
  ciur();
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> x;
    if (!tolate) {
      if (desc(x))
        cout << x << ' ';
      else
        tolate = 1;
    }
    if (tolate >= 1) {
      while (c[prim[ind]] == 1) {
        ind++;
      }
      y = prim[ind];
      if (tolate == 1) {
        tolate = 2;
        if (y < x) y = x;
        while (desc(y) == false) y++;
      } else {
        c[prim[ind]] = 1;
      }
      cout << y << ' ';
    }
  }
  return 0;
}
