#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000000;
int n, a[maxn], fre[maxn], have[maxn];
bool fin(int a) {
  while (a > 1) {
    int p = fre[a];
    if (have[p]) return false;
    while (a % p == 0) a /= p;
  }
  return true;
}
void increase(int a) {
  while (a > 1) {
    int p = fre[a];
    have[p]++;
    while (a % p == 0) a /= p;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  fre[1] = 1;
  for (int i = 2; i <= maxn; i++)
    if (fre[i] == 0) {
      int j = i;
      while (j <= maxn) {
        fre[j] = i;
        j += i;
      }
    }
  int id = -1;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    if (!fin(a[i])) {
      id = i;
      break;
    }
    increase(a[i]);
  }
  if (id != -1) {
    a[id]++;
    for (int i = id + 1; i <= n; i++) a[i] = 2;
    for (int i = id; i <= n; i++) {
      while (!fin(a[i])) a[i]++;
      increase(a[i]);
      if (i > id) a[i + 1] = a[i];
    }
  }
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
}
