#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
#define SIZE 100005
#define MOD 998244353

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

ll gcd(ll x,ll y)
{
	if(x==0) return y;
	return gcd(y%x,x);
}
ll A[SIZE];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%lld",&A[i]);
	sort(A,A+n);
	ll ret=A[0];
	for(int i=1;i<n;i++)
	{
		ret=ret*gcd(A[i],i)%MOD;
	}
	printf("%lld\n",ret);
	return 0;
}
