#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 200005
#define ll long long
#define ld double
#define mod 998244353
using namespace std;
int gcd(int a, int b)
{
	if(!b) return a;
	return gcd(b, a % b);
}
int x[maxn];
int n;
int main()
{
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
		scanf("%d", &x[i]);
	sort(x, x + n);
	ll ans = 1;
	for(int i = 0; i < n; i++)
		ans = ans * gcd(x[i], i) % mod;
	printf("%lld\n", ans);
	return 0;
 } 