#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9 + 10;
const long long MOD = 998244353;
const int MAXN = 2e5 + 5;
int v[MAXN];
void solve() {
  int n;
  scanf("%d", &n);
  for (int i = (0); i < (int)(n); i++) {
    scanf("%d", &v[i]);
  }
  sort(v, v + n);
  long long ans = v[0] % MOD;
  int g = v[0];
  for (int i = (1); i < (int)(n); i++) {
    g = gcd(g, v[i]);
  }
  for (int i = (1); i <= (int)(n - 1); i++) {
    int v = gcd(g, i);
    ans = (ans * v) % MOD;
    g /= v;
  }
  printf("%lld\n", ans);
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
