#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
int main() {
  vector<long long int> isp(10000003, 0);
  isp[0] = isp[1] = 1;
  vector<long long int> p;
  for (long long int i = 2; i <= 10000000; ++i) {
    if (!isp[i]) {
      p.push_back(i);
      isp[i] = i;
      for (long long int j = i * i; j <= 10000000; j += i)
        if (!isp[j]) isp[j] = i;
    }
  }
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  bool z = false;
  vector<long long int> b;
  map<long long int, bool> m;
  for (long long i = 0; i < n; i++) {
    long long int t = a[i];
    vector<long long int> tem;
    while (t != 1) {
      if (!m[isp[t]]) {
        tem.push_back(isp[t]);
        t /= isp[t];
      } else
        break;
    }
    if (t != 1) break;
    b.push_back(a[i]);
    while (tem.size() != 0) {
      m[tem.back()] = true;
      tem.pop_back();
    }
  }
  z = true;
  if (b.size() != n) {
    for (long long i = a[b.size()] + 1; i < 10000001; i++) {
      long long int t = i;
      vector<long long int> tem;
      while (t != 1) {
        if (!m[isp[t]]) {
          tem.push_back(isp[t]);
          t /= isp[t];
        } else
          break;
      }
      if (t == 1) {
        b.push_back(i);
        while (tem.size() != 0) {
          m[tem.back()] = true;
          tem.pop_back();
        }
        break;
      }
    }
  }
  for (long long int i = 0; i < p.size() && b.size() != n; ++i) {
    if (!m[p[i]]) b.push_back(p[i]);
  }
  for (long long i = 0; i < b.size(); i++) cout << b[i] << " ";
}
