#include <bits/stdc++.h>
using namespace std;
int vis[1500000 + 5], a[1000006], marked[1500000], pt = 2;
vector<int> v[1500000 + 5];
bool broken;
bool hoyKina(int x) {
  for (int i = 0; i < v[x].size(); i++) {
    if (marked[v[x][i]]) return false;
  }
  for (int i = 0; i < v[x].size(); i++) {
    marked[v[x][i]] = 1;
  }
  return true;
}
int cal(int x) {
  if (broken) {
    while (1) {
      if (hoyKina(pt)) return pt;
      pt++;
    }
  }
  while (1) {
    if (hoyKina(x)) return x;
    broken = true;
    x++;
  }
}
int main() {
  for (int i = 2; i <= 1500000; i++) {
    if (vis[i]) continue;
    for (int j = i; j <= 1500000; j += i) {
      vis[j] = 1;
      v[j].push_back(i);
    }
  }
  int n, x;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    printf("%d ", cal(x));
  }
  printf("\n");
  return 0;
}
