using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static System.Console;

namespace ConsoleApp2
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var an = Console.ReadLine().Split().Select(s => new BitArray(new int[] { (int.Parse(s)) })).ToList();
            for (var i=2;i<N;i++)
            {
                var tmp = an[i - 2].Xor(an[i-1]).Xor(an[i]);
                for(var j=0;j<tmp.Length;j++)
                {
                    if(tmp[j])
                    {
                        Console.WriteLine("No");
                        return;
                    }
                }
            }
            Console.WriteLine("Yes");
        }

    }
}