#include <bits/stdc++.h>
using namespace std;
const int OO = 0x3f3f3f3f, N = 1e7 + 5, mod = 1e9 + 7;
int n, arr[N], lst = 2;
bool flag[N], yo;
bool OK(int x, bool is) {
  if (is == 0 && flag[x] == 1) return 0;
  if (is == 1) flag[x] = 1;
  for (int i = 2; i * i <= x; ++i) {
    if (x % i == 0) {
      if (is == 0 && (flag[i] || flag[x / i]))
        return 0;
      else if (is == 1)
        flag[i] = flag[x / i] = 1;
    }
  }
  return 1;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) scanf("%d", arr + i);
  for (int i = 0; i < n; ++i) {
    if (yo == 0 && OK(arr[i], 0)) {
      printf("%d ", arr[i]);
      OK(arr[i], 1);
    } else {
      int x = lst;
      if (yo == 0) x = arr[i] + 1;
      for (int j = x; j < 1e7; ++j) {
        if (OK(j, 0)) {
          printf("%d ", j);
          OK(j, 1);
          if (yo) lst = j + 1;
          break;
        }
      }
      yo = 1;
    }
  }
  return 0;
}
