#include <bits/stdc++.h>
      
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())

#define pb emplace_back
#define fi first
#define se second

using namespace std;

using ld = long double;
using ll = long long int;

const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ll MOD = 998244353;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> void UNIQUE(vector<T> &a){ a.erase(unique(a.begin(), a.end()), a.end()); }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll in(){long long int x; scanf("%lld", &x); return x;}
ld fin(){double x; scanf("%lf", &x); return x;}
char yuyushiki[1000010]; string stin(){scanf( "%s", yuyushiki ); return yuyushiki;}

// head

vector<int> v, s;
vector<bool> used;
void dfs(int x){
  used[x] = true;
  s.pb(x);
  if(!used[v[x]]){
    dfs(v[x]);
  }
}

const ll N = 100010;

int main(){

  vector<ll> ps(0);
  vector<bool> isp(N, true);
  isp[0] = isp[1] = false;
  FOR(i, 2, N){
    if(isp[i]){
      ps.pb(i);
      for(ll j = i*2; j < N; j += i){
        isp[j] = false;
      }
    }
  }

  ll n = in();
  vector<ll> b(n);
  REP(i, n){
    b[i] = in();
  }

  sort(b.begin(), b.end());
  
  ll res = b[0] % MOD;
  YYS(w, ps){
    ll cur = w;
    ll cnt = 0;
    while(cur <= n - 1){
      cnt += (n - 1) / cur;
      cur *= w;
    }
    for(ll i = w; i < n; i += w){
      ll j = 0;
      cur = b[i];
      while(cur % w == 0){
        cur /= w;
        j++;
      }
      cur = i;
      while(cur % w == 0){
        cur /= w;
        j--;
      }
      if(j < 0){
        cnt += j;
      }
    }
    // cout << w << " " << cnt << endl;
    REP(i, cnt){
      res *= w;
      res %= MOD;
    }
  }

  cout << res << endl;
  
  return 0;
}
