#include <bits/stdc++.h>
using namespace std;
bool isPrime(int a) {
  for (int i = 2; i <= sqrt(a); ++i) {
    if (a % i == 0) return false;
  }
  return true;
}
int main() {
  int a, b = 0;
  cin >> a;
  for (int i = 0; i < a; ++i) {
    cin >> b;
    if (isPrime(b)) b++;
  }
  cout << b;
}
