#include <bits/stdc++.h>
const int mod = 998244353;
int n, x, ans;
int gcd(int a, int b) { return (!b) ? a : gcd(b, a % b); }
int main() {
  scanf("%d", &n);
  ans = 1;
  for (int i = 1; i <= n; i++)
    scanf("%d", &x), ans = 1ll * ans * gcd(i - 1, x) % mod;
  printf("%d\n", ans);
  return 0;
}
