#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B>
bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
long long inf = sizeof(long long) == sizeof(long long) ? 2e18 : 1e9 + 10;
long long dx[] = {0, 1, 0, -1};
long long dy[] = {1, 0, -1, 0};
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
signed main() {
  long long n;
  cin >> n;
  long long MOD = 998244353;
  long long out = 1;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    (out *= gcd(a, n - i - 1)) %= MOD;
  }
  cout << out << endl;
}
