#include <bits/stdc++.h>
using namespace std;
void rd(int &x) {
  int k, m = 0;
  x = 0;
  for (;;) {
    k = getchar_unlocked();
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      x = k - '0';
      break;
    }
  }
  for (;;) {
    k = getchar_unlocked();
    if (k < '0' || k > '9') {
      break;
    }
    x = x * 10 + k - '0';
  }
  if (m) {
    x = -x;
  }
}
void wt_L(long long x) {
  char f[20];
  int m = 0, s = 0;
  if (x < 0) {
    m = 1;
    x = -x;
  }
  while (x) {
    f[s++] = x % 10;
    x /= 10;
  }
  if (!s) {
    f[s++] = 0;
  }
  if (m) {
    putchar_unlocked('-');
  }
  while (s--) {
    putchar_unlocked(f[s] + '0');
  }
}
template <class S, class T>
inline S min_L(S a, T b) {
  return a <= b ? a : b;
}
template <class T>
void Unique_L(int &N, T A[], int sorted = 0) {
  int i, k;
  if (!sorted) {
    sort(A, A + N);
  }
  k = 0;
  for (i = 0; i < N; i++) {
    if (k == 0 || A[k - 1] != A[i]) {
      A[k++] = A[i];
    }
  }
  N = k;
}
int A[100000], N, p[10000000], sz;
int g(int a, int b) {
  int res = 0;
  while (a % b == 0) {
    a /= b;
    res++;
  }
  return res;
}
int main() {
  int cnt, i, j, k, m, r1, r2, x;
  long long res;
  rd(N);
  {
    int Lj4PdHRW;
    for (Lj4PdHRW = 0; Lj4PdHRW < N; Lj4PdHRW++) {
      rd(A[Lj4PdHRW]);
    }
  }
  {
    int KL2GvlyY, Q5VJL1cS;
    if (N == 0) {
      Q5VJL1cS = 0;
    } else {
      Q5VJL1cS = A[0];
      for (KL2GvlyY = 1; KL2GvlyY < N; KL2GvlyY++) {
        Q5VJL1cS = min_L(Q5VJL1cS, A[KL2GvlyY]);
      }
    }
    m = Q5VJL1cS;
  }
  cnt = 0;
  for (i = 0; i < N; i++) {
    if (m == A[i]) {
      cnt++;
    }
  }
  for (i = 0; i < N; i++) {
    k = A[i];
    for (j = 2; j * j <= k; j++) {
      if (k % j == 0) {
        p[sz++] = j;
        while (k % j == 0) {
          k /= j;
        }
      }
    }
    if (k != 1) {
      p[sz++] = k;
    }
  }
  for (i = 0; i < N; i++) {
    k = i + 1;
    for (j = 2; j * j <= k; j++) {
      if (k % j == 0) {
        p[sz++] = j;
        while (k % j == 0) {
          k /= j;
        }
      }
    }
    if (k != 1) {
      p[sz++] = k;
    }
  }
  Unique_L(sz, p);
  res = 1;
  for (k = 0; k < sz; k++) {
    x = p[k];
    r1 = r2 = 0;
    for (i = 0; i < N; i++) {
      r1 += g(A[i], x);
    }
    r2 += g(m, x);
    for (i = 1; i < cnt; i++) {
      r2 += g(i, x);
    }
    j = min_L(r1, r2);
    for (i = 0; i < j; i++) {
      res = (res * x) % 998244353;
    }
  }
  wt_L(res);
  putchar_unlocked('\n');
  return 0;
}
