using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var hatCnt = long.Parse(Console.ReadLine());
        var line2 = Console.ReadLine().Split().Select(long.Parse).ToArray();

        bool judge = false;
        for (long i = 0; i < hatCnt; i++)
        {
            long myNum = line2[i];

            if (i == 0)
            {
                var xor = GetXor(line2[hatCnt - 1], line2[i + 1]);
                judge = CheckHatNum(myNum, xor);
            }
            else if (i == hatCnt - 1)
            {
                var xor = GetXor(line2[i - 1], line2[0]);
                judge = CheckHatNum(myNum, xor);
            }
            else
            {
                var xor = GetXor(line2[i - 1], line2[i + 1]);
                judge = CheckHatNum(myNum, xor);
            }

            if (!judge)
            {
                Console.WriteLine("No");
                break;
            }
        }
        if (judge)
        {
            Console.WriteLine("Yes");
        }
    }

    public static long GetXor(long R, long L)
    {
        return R ^ L;
    }

    public static bool CheckHatNum(long myNum, long xor)
    {
        return myNum == xor;
    }
}
