#include #define rep(i, n) for(int i=0, i##_len=(n); i=0; --i) #define rreps(i, n) for(int i=((int)(n)); i>0; --i) #define all(v) (v).begin(), (v).end() using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector; using vvi = vector>; using vvvi = vector>>; using vl = vector; using vvl = vector>; using vvvl = vector>>; using vs = vector; using pi = pair; using pl = pair; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (bbool chmaxeq(T &a, const T &b) { if (a<=b) { a=b; return 1; } return 0; } templatebool chmineq(T &a, const T &b) { if (b<=a) { a=b; return 1; } return 0; } bool yes(bool a) { cout << (a?"yes":"no") << endl; return a; } bool Yes(bool a) { cout << (a?"Yes":"No") << endl; return a; } bool YES(bool a) { cout << (a?"YES":"NO") << endl; return a; } void _main(); int main() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(16); _main(); return 0; } const int mod = 998244353; struct mint { long long x; mint(long long x = 0) : x((x%mod+mod)%mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint &operator++() { *this += 1; return *this; } mint operator++(int) { mint temp = *this; ++*this; return temp; } mint &operator--() { *this -= 1; return *this; } mint operator--(int) { mint temp = *this; --*this; return temp; } mint operator+(const mint a) { return mint(*this) += a; } mint operator-(const mint a) { return mint(*this) -= a; } mint operator*(const mint a) { return mint(*this) *= a; } mint pow(long long t) const { if (t < 0) return pow(-t).inv(); if (t == 0) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return *this *= a.inv(); } mint operator/(const mint a) { return mint(*this) /= a; } friend istream &operator>>(istream &is, mint &a) { long long x; is >> x; a = mint(x); return is; } friend ostream &operator<<(ostream &os, const mint &a) { os << a.x; return os; } }; void _main() { int N; cin >> N; int cnt = 0; rep(i, N) { int A; cin >> A; if (A == 0) cnt++; } cout << mint(min(cnt, N-cnt))/N << endl; }