#include <bits/stdc++.h>
using namespace std;
const int N = 3e6 + 5;
int mark[N], a[N], b[N], visit[N];
vector<int> v;
void fun() {
  mark[0] = mark[1] = 1;
  for (long long int i = 2; (i * i) < N; i++) {
    if (mark[i] == 0) {
      for (long long int j = i * i; j < N; j += i) mark[j] = 1;
    }
  }
  int cnt = 0;
  for (long long int i = 1; i < N; i++) {
    if (mark[i] == 0) {
      v.push_back(i);
      cnt++;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  fun();
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    int x = a[i];
    int y = 2;
    int flag = 0;
    while (x > 1) {
      int lol = 0;
      while (x % y == 0) {
        lol = 1;
        if (visit[y]) {
          flag = 1;
          break;
        }
        x /= y;
      }
      if (flag) {
        for (int l = 0; v[l] < y; l++) {
          if (a[i] % v[l] == 0) visit[v[l]] = 0;
        }
        break;
      }
      if (lol) visit[y] = 1;
      y++;
    }
    if (!flag) {
      b[i] = a[i];
    } else {
      for (int j = a[i] + 1;; j++) {
        int flag = 0;
        int y = 2, x = j;
        while (x > 1) {
          int lol = 0;
          while (x % y == 0) {
            lol = 1;
            x /= y;
          }
          if (lol && visit[y]) {
            flag = 1;
            break;
          }
          y++;
        }
        if (x == 1 && flag == 0) {
          b[i] = j;
          int xx = j, y = 2;
          while (xx > 1) {
            while (xx % y == 0) {
              xx /= y;
              visit[y] = 1;
            }
            y++;
          }
          break;
        }
      }
      int k = i + 1;
      for (int j = 0; k < n; j++) {
        if (visit[v[j]])
          continue;
        else {
          b[k] = v[j];
          k++;
        }
      }
      break;
    }
  }
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  cout << endl;
  return 0;
}
