#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 10;
const int M = 1000000007;
const double eps = 1e-9;
const double PI = acos(-1);
const int oo = 1000000000;
int n, v[N], pr[30 * N], mn[30 * N];
set<int> used;
bool can(int d) {
  if (d == 1) return false;
  vector<int> cur;
  while (d > 1) {
    if (used.find(mn[d]) != used.end()) return false;
    cur.push_back(mn[d]);
    d /= mn[d];
  }
  for (int x : cur) used.insert(x);
  return true;
}
int main() {
  int ct = 0;
  for (int i = 2; i < 30 * N; ++i) {
    if (pr[i]) continue;
    ++ct;
    mn[i] = i;
    for (int j = i + i; j < 30 * N; j += i) {
      pr[j] = 1;
      mn[j] = i;
    }
  }
  cin >> n;
  bool f = 1;
  for (int i = 0, j = 2; i < n; ++i) {
    scanf("%d", &v[i]);
    if (f && can(v[i]))
      printf("%d ", v[i]);
    else {
      if (f) j = v[i] + 1;
      while (!can(j)) ++j;
      printf("%d ", j++);
      if (f) j = 2;
      f = 0;
    }
  }
  return 0;
}
