#include<bits/stdc++.h>
#define ll long long
#define inf 1000000000
#define vi vector<int>
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mpr make_pair
#define fi first
#define se second
#define pq priority_queue<int>
#define pqll priority_queue<ll>
#define up(x,y) (x<(y)?x=(y):0)
#define dn(x,y) (x>(y)?x=(y):0)
#define ad(x,y) (x=(x+(y))%mod)
using namespace std;

int n,a[100009];
int gcd(int x,int y){ return y?gcd(y,x%y):x; }
int main(){
	scanf("%d",&n);
	int i;
	for (i=1; i<=n; i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	int ans=a[1];
	for (i=2; i<=n; i++) ans=(ll)ans*gcd(i-1,a[i])%998244353;
	printf("%d\n",ans);
	return 0;	
}