#include <bits/stdc++.h>
using namespace std;
int isprime[5000005];
int ok[5000005];
set<int> prime;
int main() {
  for (int i = 2; i < 5000005; i++) {
    if (!isprime[i]) {
      prime.insert(i);
      for (int j = i; j < 5000005; j += i) {
        isprime[j] = i;
      }
    }
  }
  fill(ok, ok + 1000005, 1);
  int n;
  scanf("%d", &n);
  int a[100005];
  int ook = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (ook) {
      printf("%d ", *prime.begin());
      prime.erase(prime.begin());
      continue;
    }
    int temp = a[i];
    int ori = a[i];
    while (true) {
      if (ok[temp]) break;
      temp++;
    }
    printf("%d ", temp);
    if (temp != ori) {
      ook = 1;
    }
    while (temp != 1) {
      int first = isprime[temp];
      prime.erase(first);
      for (int i = first; i <= 1000005; i += first) {
        ok[i] = 0;
      }
      temp /= first;
    }
  }
  printf("\n");
}
