#include <bits/stdc++.h>
using namespace std;
int a[100010];
map<int, int> mp;
bool f(int x) {
  bool res = 0;
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      if (mp.count(i)) res = 1;
      mp[i]++;
      while (x % i == 0) x /= i;
    }
  }
  if (x > 1) {
    if (mp.count(x)) res = 1;
    mp[x]++;
  }
  return res;
}
bool rm(int x) {
  bool res = 0;
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      if (mp.count(i)) res = 1;
      mp[i]--;
      if (mp[i] == 0) mp.erase(i);
      while (x % i == 0) x /= i;
    }
  }
  if (x > 1) {
    if (mp.count(x)) res = 1;
    mp[x]--;
    if (mp[x] == 0) mp.erase(x);
  }
  return res;
}
bool is(int x) {
  bool res = 0;
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      if (mp.count(i)) return 0;
      while (x % i == 0) x /= i;
    }
  }
  if (x > 1)
    if (mp.count(x)) return 0;
  return 1;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    if (f(a[i])) {
      rm(a[i]);
      int res = a[i];
      while (!is(res)) ++res;
      a[i] = res;
      f(res);
      res = 2;
      for (int j = i + 1; j <= n; j++) {
        while (!is(res)) ++res;
        f(res);
        a[j] = res;
      }
      break;
    }
  }
  for (int i = 1; i <= n; i++) cout << a[i] << (i == n ? "" : " ");
  cout << endl;
  return 0;
}
