#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
int n, a[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  int ans = a[1];
  for (int i = 2; i <= n; ++i) {
    ans = min(ans, a[i]);
  }
  ans %= 998244353;
  printf("%d\n", ans);
  return 0;
}
