#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=998244353;
ll gcd(ll a, ll b){
  if(b==0) return a;
  return gcd(b, a%b);
}
int main()
{
	int n; cin>>n;
  ll a[100000];
  for(int i=0; i<n; i++) cin>>a[i];
  sort(a, a+n);
  ll ans=a[0];
  for(ll i=1; i<n; i++){
    ans=ans*gcd(a[i], i)%MOD;
  }
  cout<<ans<<endl;
	return 0;
}