#include <bits/stdc++.h>
using namespace std;
void find_primes(vector<bool>& vec) {
  int n = vec.size();
  vec[0] = vec[1] = false;
  for (int i = 2; i <= n; ++i)
    if (vec[i])
      if (i * 1ll * i <= n)
        for (int j = i * i; j <= n; j += i) vec[j] = false;
}
void factor(int n, list<int>& lst) {
  lst.clear();
  bool go = true;
  while (go) {
    go = false;
    for (int i = 2; i * i <= n; i++) {
      if (n % i == 0) {
        lst.push_back(i);
        n /= i;
        go = true;
        break;
      }
    }
  }
  lst.push_back(n);
}
bool check_primes(list<int>& lst, vector<bool>& vec) {
  bool res = true;
  for (auto& elem : lst) {
    if (vec[elem] == false) {
      res = false;
      break;
    }
  }
  return res;
}
void mark_primes(list<int>& lst, vector<bool>& vec) {
  for (auto& elem : lst) {
    vec[elem] = false;
  }
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int k = 1e+7;
  vector<bool> vec(k + 1, true);
  find_primes(vec);
  list<int> lst;
  list<int> lst2;
  int start = 0;
  bool increased = false;
  for (int i = 0; i < n; i++) {
    if (increased) {
      for (int j = start; j < k; j++) {
        if (vec[j] == true) {
          vec[j] = false;
          start = j;
          cout << j << ' ';
          break;
        }
      }
    } else {
      factor(a[i], lst);
      bool ok = check_primes(lst, vec);
      if (ok) {
        mark_primes(lst, vec);
        cout << a[i] << ' ';
      } else {
        int q = 0;
        for (int j = a[i] + 1; j < k; j++) {
          if (vec[j] == true) {
            q = j;
            break;
          }
        }
        for (int j = a[i] + 1; j <= q; j++) {
          factor(j, lst2);
          bool ok2 = check_primes(lst2, vec);
          if (ok2) {
            mark_primes(lst2, vec);
            cout << j << ' ';
            break;
          }
        }
        increased = true;
      }
    }
  }
  return 0;
}
