#include <bits/stdc++.h>
using namespace std;
const int _size_ = 10005000;
vector<int> GetPrimes(int n) {
  vector<int> res;
  int m = n;
  for (int i = 2; i * i <= n; i++) {
    if (m % i == 0) {
      res.push_back(i);
      while (m % i == 0) m /= i;
    }
  }
  if (m != 1) res.push_back(m);
  return res;
}
bool prime[10005000];
bool was[10005000] = {};
bool collision(vector<int> v) {
  for (int j = 0; j < v.size(); j++) {
    if (was[v[j]]) {
      return 1;
      break;
    }
  }
  return 0;
}
void mark(vector<int> v) {
  for (int j = 0; j < v.size(); j++) was[v[j]] = 1;
}
void kill(int cnt) {
  vector<int> p;
  for (int i = 2; i < _size_; i++)
    if (prime[i] && !was[i]) p.push_back(i);
  for (int i = 0; i < cnt; i++) cout << p[i] << ' ';
}
int main() {
  ios_base::sync_with_stdio(false);
  for (int i = 0; i < _size_; i++) prime[i] = 1;
  prime[0] = prime[1] = 0;
  for (long long i = 2; i < _size_; i++) {
    if (prime[i]) {
      for (long long j = i * i; j < _size_; j += i) prime[j] = 0;
    }
  }
  int n, item;
  cin >> n;
  vector<int> buf;
  for (int i = 0; i < n; i++) {
    cin >> item;
    buf = GetPrimes(item);
    if (!collision(buf)) {
      cout << item << ' ';
      mark(buf);
    } else {
      for (int cur = item + 1; cur < _size_; cur++) {
        buf = GetPrimes(cur);
        if (!collision(buf)) {
          cout << cur << ' ';
          mark(buf);
          kill(n - i - 1);
          return 0;
        }
      }
    }
  }
  return 0;
}
