#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long MOD = 1000000007;
const long long MX = 10000000;
long long A, spf[10000007];
bitset<10000007> seen;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (long long i = 1; i <= MX; ++i) spf[i] = i;
  for (long long i = 2; i <= MX; ++i) {
    if (spf[i] == i)
      for (long long j = i * i; j <= MX; j += i)
        if (spf[j] == j) spf[j] = i;
  }
  long long n, d, h;
  cin >> n;
  bool go = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> A;
    d = ((!go) ? 0 : d), h = -1;
    while (1) {
      long long a = ((!go) ? A : 2) + d;
      bool st = 0;
      while (a != 1) {
        if (seen[spf[a]]) {
          st = 1;
          break;
        }
        a /= spf[a];
      }
      if (!st) {
        h = ((!go) ? A : 2) + d;
        if ((!go) && d) go = 1, d = 0;
        break;
      }
      d++;
    }
    cout << h << " ";
    while (h != 1) seen[spf[h]] = 1, h /= spf[h];
  }
  return 0;
}
