N = int(input()) A = list(map(int, input().split())) cnt = A.count(1) mod = 998244353 print(cnt * pow(N, mod - 2, mod) % mod)