#include <bits/stdc++.h>
using namespace std;
const int maxn = 1400000 + 100;
int n, cnt;
int num[maxn], ans[maxn];
int prime[maxn];
bool vis[maxn];
vector<int> fac[maxn];
set<int> st;
set<int>::iterator it;
void Prime() {
  for (int i = 2; i < maxn; ++i) {
    if (!vis[i]) {
      prime[cnt++] = i;
      st.insert(i);
    }
    for (int j = 0; j < cnt && i < maxn / prime[j]; ++j) {
      int k = i * prime[j];
      vis[k] = true;
      if (i % prime[j] == 0) {
        break;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  Prime();
  for (int i = 0; i < cnt; ++i) {
    for (int j = prime[i]; j < 100100; j += prime[i]) {
      fac[j].push_back(prime[i]);
    }
  }
  scanf("%d", &n);
  bool flag = false;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &num[i]);
    if (flag) {
      it = st.begin();
      ans[i] = *it;
      st.erase(it);
    } else {
      int len = fac[num[i]].size();
      bool f = true;
      for (int j = 0; j < len; ++j) {
        if (vis[fac[num[i]][j]]) {
          f = false;
          break;
        }
      }
      if (!f) {
        flag = true;
        int x = num[i];
        bool ff = true;
        while (ff) {
          ++x;
          ff = false;
          len = fac[x].size();
          for (int j = 0; j < len; ++j) {
            if (vis[fac[x][j]]) {
              ff = true;
              break;
            }
          }
        }
        ans[i] = x;
        len = fac[x].size();
        for (int j = 0; j < len; ++j) {
          st.erase(fac[x][j]);
          vis[fac[x][j]] = true;
        }
      } else {
        for (int j = 0; j < len; ++j) {
          st.erase(fac[num[i]][j]);
          vis[fac[num[i]][j]] = true;
        }
        ans[i] = num[i];
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (i != 1) {
      printf(" ");
    }
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}
