Scanf.scanf "%d" (fun n -> let z = 998244353 in let ( *@) a b = (a * b) mod z in let ( /@) a b = let extgcd x y = let rec eg r0 r1 a0 a1 = if r1 = 0 then a0 else let q1 = r0 / r1 in eg r1 (r0 mod r1) a1 (a0 - q1 * a1) in eg x y 1 0 in let inv x y = (* 1/x in mod y *) let c = extgcd x y in if c < 0 then c + y else c in a *@ inv b z in let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in let sum = Array.fold_left (+) 0 a in let sum = if sum * 2 >= n then n - sum else sum in Printf.printf "%d\n" @@ (sum /@ n) )