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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

const int MOD = 998244353;

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

int dfs(int i, vector<int>& p, vector<int>& a, vector<bool>& vis) {
    if (vis[i]) return INT_MAX;
    vis[i] = true;
    return min(a[i], dfs(p[i], p, a, vis));
}

int main() {
    int N; cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    sort(all(a));
    ll ans = 1;
    rep(i, N) ans = ans * gcd(i, a[i]) % MOD;
    cout << ans << endl;
    return 0;
    for (;;) {
        int N; cin >> N;
        vector<int> a(N);
        rep(i, N) cin >> a[i];
        vector<int> p(N);
        iota(all(p), 0);
        vector<ll> ans(N + 1);
        do {
            vector<bool> vis(N);
            int k = 0;
            ll x = 1;
            rep(i, N) if (!vis[i]) {
                k++;
                x *= dfs(i, p, a, vis);
            }
            ans[k] += x;
        } while (next_permutation(all(p)));
        rep(k, N + 1) cout << ans[k] << ' ';
        cout << endl;
        ll d = 0;
        rep(k, N + 1) d = gcd(d, ans[k]);
        cout << d << endl;
    }
}

### Prompt

Construct a cpp code solution to the problem outlined:

Niwango-kun has \\(N\\) chickens as his pets. The chickens are identified by numbers \\(1\\) to \\(N\\), and the size of the \\(i\\)-th chicken is a positive integer \\(a_i\\).

\\(N\\) chickens decided to take each other's hand (wing) and form some cycles. The way to make cycles is represented by a permutation \\(p\\) of \\(1, \ldots , N\\). Chicken \\(i\\) takes chicken \\(p_i\\)'s left hand by its right hand. Chickens may take their own hand.

Let us define the cycle containing chicken \\(i\\) as the set consisting of chickens \\(p_i, p_{p_i}, \ldots, p_{\ddots_i} = i\\). It can be proven that after each chicken takes some chicken's hand, the \\(N\\) chickens can be decomposed into cycles.

The beauty \\(f(p)\\) of a way of forming cycles is defined as the product of the size of the smallest chicken in each cycle. Let \\(b_i \ (1 \leq i \leq N)\\) be the sum of \\(f(p)\\) among all possible permutations \\(p\\) for which \\(i\\) cycles are formed in the procedure above.

Find the greatest common divisor of \\(b_1, b_2, \ldots, b_N\\) and print it \\({\rm mod} \ 998244353\\).

Constraints

* \\(1 \leq N \leq 10^5\\)
* \\(1 \leq a_i \leq 10^9\\)
* All numbers given in input are integers

Input

Input is given from Standard Input in the following format:


\(N\)
\(a_1\) \(a_2\) \(\ldots\) \(a_N\)


Output

Print the answer.

Examples

Input

2
4 3


Output

3


Input

4
2 5 2 5


Output

2

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

const int MOD = 998244353;

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

int dfs(int i, vector<int>& p, vector<int>& a, vector<bool>& vis) {
    if (vis[i]) return INT_MAX;
    vis[i] = true;
    return min(a[i], dfs(p[i], p, a, vis));
}

int main() {
    int N; cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    sort(all(a));
    ll ans = 1;
    rep(i, N) ans = ans * gcd(i, a[i]) % MOD;
    cout << ans << endl;
    return 0;
    for (;;) {
        int N; cin >> N;
        vector<int> a(N);
        rep(i, N) cin >> a[i];
        vector<int> p(N);
        iota(all(p), 0);
        vector<ll> ans(N + 1);
        do {
            vector<bool> vis(N);
            int k = 0;
            ll x = 1;
            rep(i, N) if (!vis[i]) {
                k++;
                x *= dfs(i, p, a, vis);
            }
            ans[k] += x;
        } while (next_permutation(all(p)));
        rep(k, N + 1) cout << ans[k] << ' ';
        cout << endl;
        ll d = 0;
        rep(k, N + 1) d = gcd(d, ans[k]);
        cout << d << endl;
    }
}

```