#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int N;
const LL MOD = 998244353;
LL gcd(LL a, LL b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  cin >> N;
  LL ans = 1;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    ans *= gcd(a, i - 1);
    ans %= MOD;
  }
  cout << ans << endl;
}
