open Hashtbl
let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let k = n / 3
let h = create 100000
let c = Array.iter (fun a -> replace h a @@ if mem h a then find h a + 1 else 1) a_s; length h
let f2 z m = mem h 0 && find h 0 = z && fold (fun a c b -> if a <> 0 && c = m then true else b) h false
let f3 () = if c = 2 then f2 k (2 * k) else
  if c = 3 then
    let b, ns = fold (fun a c (b, acc) -> if not b then b, acc else c = k, a :: acc) h (true, []) in
    let ns = Array.of_list ns in b && ns.(0) lxor ns.(1) lxor ns.(2) = 0
  else false
let b = if c = 1 then mem h 0 else n mod 3 = 0 && f3 ()
let _ = print_endline @@ if b then "Yes" else "No"