{-# LANGUAGE BangPatterns, MultiWayIf #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Int
import Data.Foldable
import Data.List
import Data.Bits
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Data.ByteString.Internal (accursedUnutterablePerformIO)
import Debug.Trace
import qualified Data.IntMap as M

solve :: Int -> VU.Vector Int -> Bool
solve !n !vn
  | VU.all (== 0) vn = True
  | M.size mp /= 3 = False
  | otherwise =  all (\v -> v == n `div` 3) (M.elems mp)
  && isXorTriple (M.keys mp)
 where
  isXorTriple [x, y, z] = x `xor` y == z || y `xor` z == x || z `xor` x == y
  mp = VU.foldl' (\(!mp) (!v) -> M.insertWith (+) v (1 :: Int) mp) M.empty vn

main = do
  let readInt :: Integral a => B.ByteString -> Maybe (a, B.ByteString)
      readInt = fmap (first fromIntegral . second B.tail) . B.readInt

  n  <- (\vec -> (vec VU.! 0)) . VU.unfoldrN 1 readInt <$> B.getLine
  vn <- VU.unfoldrN n readInt <$> B.getLine

  putStrLn $ if solve n vn then "Yes" else "No"
