#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

const LL P = 998244353;
const int maxN = 100000 + 233;
LL gcd(LL x, LL y) {
	return y == 0 ? x : gcd(y, x % y);
}
int n, a[maxN];

int main() {
	ios::sync_with_stdio(false);
	cin >> n;
	for(int i = 0; i < n; ++i) cin >> a[i];
	sort(a, a + n);
	LL ans = 1;
	for(int i = 0; i < n; ++i) ans = ans * gcd(a[i], i) % P;
	cout << ans << endl;
	return 0;
}
