#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e7;
int prime[MAX + 5];
bool vis[MAX + 5];
vector<int> primes;
void pre() {
  prime[0] = prime[1] = 1;
  for (int i = 2; i <= MAX; i++) {
    if (prime[i]) continue;
    prime[i] = i;
    primes.push_back(i);
    for (int j = i; j <= MAX; j += i) {
      prime[j] = i;
    }
  }
}
void visit(int x) {
  while (x != 1) {
    vis[prime[x]] = 1;
    x /= prime[x];
  }
}
bool check(int x) {
  while (x != 1) {
    if (vis[prime[x]]) return 0;
    x /= prime[x];
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  pre();
  int n;
  cin >> n;
  bool equal = 1;
  while (n-- && equal) {
    int x;
    cin >> x;
    if (check(x)) {
      visit(x);
      cout << x << ' ';
    } else {
      for (int i = x + 1;; i++) {
        if (check(i)) {
          visit(i);
          cout << i << ' ';
          equal = 0;
          break;
        }
      }
    }
  }
  for (int i = 0; i < (int)primes.size() && n != -1; i++) {
    if (!vis[primes[i]]) {
      n--;
      cout << primes[i] << ' ';
    }
  }
  return 0;
}
