#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n;
ll x[100005];
ll y = 0;
int main(){
	scanf("%d",&n);
	rep(i,n){
		scanf("%lld",&x[i]);
		y = __gcd(y,x[i]);
	}
	sort(x,x+n);
	ll ans = x[0]%mod;
	//ans += __gcd( (n-1)! , y)
	for(ll x=2;x*x<=y;x++){
		if(y%x == 0){
			int cnt = 0;
			while(y%x == 0){
				y/=x;
				cnt++;
			}
			ll d = 0;
			ll cur = (n-1);
			while(cur){
				d += cur / x;
				cur /= x;
			}
			rep(w,min(d,1LL*cnt)) ans = ans*1LL*x%mod;
		}
	}
	if(y != 1){
		int cnt = 1;
			ll d = 0;
			ll cur = (n-1);
			while(cur){
				d += cur / y;
				cur /= y;
			}
			rep(w,min(d,1LL*cnt)) ans = ans*1LL*y%mod;
		}
	
	cout << ans << endl;
}