#include <bits/stdc++.h>
using namespace std ;
#define ll long long 
#define f(i, x, n) for (int i = x; i < (int)(n); ++i)

int const md = 998244353, N = 100000;
int x[N];

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main(){
	int n;
	scanf("%d", &n);
	f(i, 0, n)scanf("%d", x + i);
	sort(x, x + n);
	int an = x[0];
	f(i, 1, n)an = (ll)an * gcd(i, x[i]) % md;
	printf("%d\n", an);
}