#include <bits/stdc++.h>
const long long use = 2000000;
using namespace std;
vector<bool> m(use, 0);
vector<long long> prime(use, 1);
bool isfine(long long x) {
  bool f = 1;
  while (x > 1) {
    if (m[prime[x]]) {
      f = 0;
      break;
    }
    x /= prime[x];
  }
  return f;
}
void makeunfine(long long x) {
  while (x > 1) {
    m[prime[x]] = 1;
    x /= prime[x];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  vector<long long> part2;
  for (long long i = 2; i < use; i++)
    if (prime[i] == 1) {
      prime[i] = i;
      part2.push_back(i);
      for (long long j = i * i; j < use; j += i)
        if (prime[j] == 1)
          prime[j] = i;
        else
          prime[j] = min(i, prime[j]);
    }
  long long j;
  for (j = 0; j < n; j++) {
    long long x = a[j];
    if (isfine(x)) {
      cout << a[j] << " ";
      makeunfine(x);
    } else {
      for (long long k = a[j] + 1; k < use; k++)
        if (isfine(k)) {
          cout << k << " ";
          makeunfine(k);
          break;
        }
      break;
    }
  }
  for (auto i : part2) {
    if (j >= n - 1) break;
    if (!m[i]) {
      cout << i << " ";
      j++;
    }
  }
}
