CodeEff/ECCO huggingface dataset:
# Original solution
import itertools
n = int(eval(input()))
a = list(map(int, input().split()))
ok = False
for v in itertools.permutations(a):
    v = v+v[:2]
    for i in range(n):
        if int(bin(v[i] ^ v[i+1] ^ v[i+2]), 2) != 0: break
        elif i == n-1 and int(bin(v[i] ^ v[i+1] ^ v[i+2]), 2) == 0: ok = True
    if ok: break
print(("Yes" if ok else "No"))

# Optimized solution
n = int(eval(input()))
a = sorted(list(map(int, input().split())))
c0 = a.count(0)

ans = "No"
if c0==n: ans = "Yes"
elif len(set(a)) == 2:
    c = a.count(a[-1])
    if c == (2*n)//3 and c0 == n//3: ans = "Yes"
elif len(set(a)) == 3:
    x,y,z = list(set(a))
    if a.count(x) == a.count(y) == a.count(z):
        if int(bin(x ^ y ^ z),2) == 0: ans = "Yes"
print(ans)
# Original solution
import random

n = int(eval(input()))
a = [int(i) for i in input().split()]

for j in range(100000):
	chk = 0
	for i in range(n-1): 
		if a[i] == a[i-1] ^ a[i+1]:
			chk += 1
		else:
			break			
	if a[n-1] == a[n-2] ^ a[0]:
		chk += 1
	if chk == n:
		print("Yes")	
		break
	else:
		random.shuffle(a)
if j == 99999:
	print("No")

# Optimized solution
n = int(eval(input()))
a = [int(i) for i in input().split()]
a_uni = list(set(a))
if len(a_uni) == 1:
	if a[0] == 0:
		print("Yes")
	else:
		print("No")
elif n%3 != 0:
	print("No")
elif len(a_uni) == 2:
	if a.count(0) == n/3:
		print("Yes")	
	else:
		print("No")	
elif len(a_uni) == 3:
	if a_uni[0]^a_uni[1]!=a_uni[2]:
		print("No")
	elif a.count(a_uni[0])==n/3 and a.count(a_uni[1])==n/3:
		print("Yes")
	else:
		print("No")
else:
	print("No")
# Original solution
n = int(eval(input()))
A = [int(i) for i in input().split()]

a = A[0]
B = A[:]
B.sort()

for i in range(1, n):
    C = [a, A[i]]
    for j in range(2, n):
        C.append(C[j - 2] ^ C[j - 1])
    if C[-2] ^ C[-1] == C[0]:
        C.sort()
        if C == B:
            print('Yes')
            exit()

print('No')

# Optimized solution
n = int(eval(input()))
A = [int(i) for i in input().split()]

S = 0

for a in A:
    S ^= a

print(('Yes' if S == 0 else 'No'))
# Original solution
std_n = int(eval(input()))
std_list = tuple(map(int, input().split()))
std_set = set(std_list)

if std_set == {0}:
    print("Yes")
    exit()
elif len(std_set) == 2:
    if 0 in std_set:
        if std_list.count(0) * 3 == std_n:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if (std_list.count(a) == std_list.count(b)) and (std_list.count(b) == std_list.count(c)):
        if a ^ b == c:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
else:
    print("No")
    exit()

############


n = int(eval(input()))
nums = list(map(int, input().split()))

unq = list(set(nums))


def answer(ans):
    print(ans)
    exit()


if len(unq) > 3:
    answer("No")

if len(unq) == 3:
    a, b, c = unq
    if a ^ b ^ c != 0:
        answer("No")
    if nums.count(a) == nums.count(b) == nums.count(c):
        answer("Yes")
    else:
        answer("No")

if len(unq) == 2:
    a, b = sorted(unq)
    if a != 0:
        answer("No")
    if nums.count(a) * 2 == nums.count(b):
        answer("Yes")
    else:
        answer("No")

if len(unq) == 1:
    a = unq[0]
    if a != 0:
        answer("No")
    else:
        answer("Yes")


# Optimized solution
std_n = int(eval(input()))
std_list = tuple(map(int, input().split()))
std_set = set(std_list)

if std_set == {0}:
    print("Yes")
    exit()
elif len(std_set) == 2:
    if 0 in std_set:
        if std_list.count(0) * 3 == std_n:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if (std_list.count(a) == std_list.count(b)) and (std_list.count(b) == std_list.count(c)):
        if a ^ b == c:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
else:
    print("No")
    exit()
# Original solution
n = int(eval(input()))
als = list(map(int,input().split()))
ans = 'No'
sett = n//3
als.sort()
if als[0] == 0:
    if als[n-1] == 0:
        ans = 'Yes'
    else:
        cc = [0]*(n//2) + [als[n-1]]*(n//2)
        if cc == als:
            ans = 'Yes'
if n%3 == 0:
    co = [als[0]]*sett + [(als[0]^als[n-1])]*sett + [als[n-1]]*sett
    if co == als:
        ans = 'Yes'
print(ans)

# Optimized solution
n = int(eval(input()))
als = list(map(int,input().split()))
ans = 'No'
sett = n//3
als.sort()
if als[0] == 0:
    if als[n-1] == 0:
        ans = 'Yes'
    #else:
        #cc = [0]*(n//2) + [als[n-1]]*(n//2)
        #if cc == als:
            #ans = 'Yes'
if n%3 == 0:
    co = [als[0]]*sett + [(als[0]^als[n-1])]*sett + [als[n-1]]*sett
    if co == als:
        ans = 'Yes'
print(ans)
# Original solution
from collections import Counter


def solve(n, aaa):
    if all(a == 0 for a in aaa):
        return True

    if n % 3 != 0:
        return False

    cnt = list(Counter(aaa).items())
    if len(cnt) == 2:
        (a1, c1), (a2, c2) = cnt
        if c1 > c2:
            c1, c2 = c2, c1
        if c1 != n // 3 or c2 != n * 2 // 3:
            return False
        return a1 == 0

    if len(cnt) == 3:
        if any(c[1] != n // 3 for c in cnt):
            return False
        a1, a2, a3 = (c[0] for c in cnt)
        return a1 ^ a2 == a3

    return False


n = int(eval(input()))
aaa = list(map(int, input().split()))
print(('Yes' if solve(n, aaa) else 'No'))


# Optimized solution
from collections import Counter


def solve(n, aaa):
    if all(a == 0 for a in aaa):
        return True

    if n % 3 != 0:
        return False

    cnt = Counter(aaa)
    if len(cnt) == 2:
        (a1, c1), (a2, c2) = cnt.most_common()
        if c1 != n * 2 // 3 or c2 != n // 3:
            return False
        return a2 == 0

    if len(cnt) == 3:
        if any(c != n // 3 for c in list(cnt.values())):
            return False
        a1, a2, a3 = list(cnt.keys())
        return a1 ^ a2 == a3

    return False


n = int(eval(input()))
aaa = list(map(int, input().split()))
print(('Yes' if solve(n, aaa) else 'No'))
# Original solution
import itertools
 
boushi_num = int(eval(input()))
boushi_No = list(map(int,input().split()))
flag = 0

jyun = list(itertools.permutations(boushi_No, boushi_num))
jyun_num = len(jyun[0])

 
for v in jyun:
  for i in range(0,jyun_num):
    i = i
    i_a = i+2
    i_b = i+1
    if i_a >boushi_num -1:
      i_a = i_a - boushi_num
    if i_b >boushi_num -1:
      i_b = i_b - boushi_num
            
    if v[i]^v[i_a] != v[i_b]:
      break
    else:
      None
            
    if i == boushi_num - 1:
      flag = 1
                
  if flag == 1:
    print('Yes')
    break
 
if flag == 0:
  print('No')

# Optimized solution
import itertools
 
boushi_num = int(eval(input()))
boushi_No = list(map(int,input().split()))
flag = 0
 
 
for v in itertools.permutations(boushi_No, boushi_num):
  for i in range(0,len(v)):
    i = i
    i_a = i+2
    i_b = i+1
    if i_a >boushi_num -1:
      i_a = i_a - boushi_num
    if i_b >boushi_num -1:
      i_b = i_b - boushi_num
            
    if v[i]^v[i_a] != v[i_b]:
      break
    else:
      None
            
    if i == boushi_num - 1:
      flag = 1
                
  if flag == 1:
    print('Yes')
    break
 
if flag == 0:
  print('No')
# Original solution
from itertools import combinations

N = int(eval(input()))
a = list(map(int, input().split()))

c = {}
for e in a:
    c.setdefault(e, 0)
    c[e] += 1

t = {}
for x, y in combinations(a, 2):
    i = x
    j = y
    t[i] = 1
    t.setdefault(j, 0)
    t[j] += 1
    for _ in range(N - 2):
        k = i ^ j
        t.setdefault(k, 0)
        t[k] += 1
        c.setdefault(k, 0)
        if t[k] > c[k]:
            j = -1
            break
        i, j = j, k
    if j ^ x == y:
        print('Yes')
        exit()
print('No')


# Optimized solution
from itertools import product

N = int(eval(input()))
a = list(map(int, input().split()))

c = {}
for e in a:
    c.setdefault(e, 0)
    c[e] += 1

if len(set(c)) > 3:
    print('No')
    exit()

t = {}
for x, y in product(set(c), repeat=2):
    i = x
    j = y
    t[i] = 1
    if t[i] > c[i]:
        continue
    t.setdefault(j, 0)
    t[j] += 1
    if t[j] > c[j]:
        continue
    for _ in range(N - 2):
        k = i ^ j
        t.setdefault(k, 0)
        t[k] += 1
        c.setdefault(k, 0)
        if t[k] > c[k]:
            j = -1
            break
        i, j = j, k
    if j ^ x == y:
        print('Yes')
        exit()
print('No')
# Original solution
N = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in a:
    if i not in d:
        d[i] = 1
    else:
        d[i] +=1
if len(d) == 1 and list(d.keys())==[0]:
    print('Yes')
elif len(d) == 2:
    for i in d:
        if i == 0 and d[i] * 3 != N or i != 0 and d[i] * 3 != 2 * N:
            print('No')
            exit()
    print('Yes')
elif len(d) == 3:
    s = 0
    for i in d:
        s ^= i
        if d[i] * 3 != N:
            print('No')
            exit()
    if s != 0:
        print('No')
    else:
        print('Yes')
else:
    print('No')


# Optimized solution
N = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in a:
    if i not in d:
        d[i] = 1
    else:
        d[i] +=1
if len(d) == 1 and 0 in d:
    print('Yes')
elif len(d) == 2:
    for i in d:
        if i == 0 and d[i] * 3 != N or i != 0 and d[i] * 3 != 2 * N:
            print('No')
            exit()
    print('Yes')
elif len(d) == 3:
    s = 0
    for i in d:
        s ^= i
        if d[i] * 3 != N:
            print('No')
            exit()
    if s != 0:
        print('No')
    else:
        print('Yes')
else:
    print('No')
# Original solution
n=int(eval(input()))
a=sorted(list(map(int,input().split())))
ans="Yes"
if n>3:
    for i in range(n-1):
        if a.count(a[i])!=a.count(a[i+1]) or a.count(a[i])==1:
            ans="No"
            break
print(ans)

# Optimized solution
n=int(eval(input()))
L=list(map(int,input().split()))
LL=list(set(L))
ans="No"
if LL==[0]:
    ans="Yes"
elif len(LL)==2:
    if L.count(LL[0])==2*L.count(LL[1]) or L.count(LL[1])==2*L.count(LL[0]):
        ans="Yes"
elif len(LL)==3:
    if L.count(LL[0])==L.count(LL[1]) and L.count(LL[1])==L.count(LL[2]):
        if LL[0]^LL[1]^LL[2]==0:
            ans="Yes"
print(ans)
# Original solution
import itertools
N=int(eval(input()))
an=[int(x) for x in map(int,input().split()[:N])]

def judgeXOR(v):
    for x in range(N):
        if x==0:
            if (v[N-1] ^ v[x+1] ) != (x+1):
                return False
        elif x==(N-1):
            if (v[0] ^ v[x-1]) !=(x+1):
                return False
        else:
            if (v[x-1] ^ v[x+1])!=(x+1):
                return False
    return True

for v in itertools.permutations(an,N):
    if v[0] !=an[0]:
        break
    if judgeXOR(v):
        print("Yes")
        exit()

print("No")


# Optimized solution
import itertools
N=int(eval(input()))
an=[int(x) for x in map(int,input().split()[:N])]

ret=an[0]
for x in range(1,N):
    ret= an[x] ^ ret

if ret==0:
    print("Yes")
else:
    print("No")
# Original solution
def get_caps(a):
  dic = dict()

  for ai in a:
    dic.setdefault(ai, 0)
    dic[ai] += 1

  return dic


def get_xor(a, b):
  bin_a = format(a, 'b')
  bin_b = format(b, 'b')

  digit = max(len(bin_a), len(bin_b))

  # 2進数のケタ数を揃える
  bin_a = bin_a.zfill(digit)
  bin_b = bin_b.zfill(digit)
  s = ''

  for i in range(len(bin_a)):
    if bin_a[i] == '0' and bin_b[i] == '1':
      s += '1'
    elif bin_a[i] == '1' and bin_b[i] == '0':
      s += '1'
    else:
      s += '0'

  # 10進数に戻す
  return int(s, 2)


def can_put_on_cap(n):
  global caps

  if n in list(caps.keys()):
    if caps[n] > 0:
      caps[n] -= 1
      return True


# A - XOR Circle
import sys
input = sys.stdin.readline
import copy

N = int(eval(input()))
a = list(map(int, input().split()))

# 帽子の情報をdictに入れる
dic = get_caps(a)

for i in range(N):
  for j in range(i+1, N):
    caps = copy.deepcopy(dic)
    caps[a[i]] -= 1
    caps[a[j]] -= 1
        
    left = a[i]
    mid = a[j]
    count = 2
    
    for k in range(N-2):
      right = get_xor(left, mid)
    
      if can_put_on_cap(right):
        left = mid
        mid = right
        count += 1
      else:
        break
    
    if count == N:
      if left ^ a[i] == right:
            print('Yes')
            exit()

print('No')

# Optimized solution
def get_caps(a):
  dic = dict()

  for ai in a:
    dic.setdefault(ai, 0)
    dic[ai] += 1

  return dic


def is_match(caps):
  global N

  if 0 in list(caps.keys()):
    if caps[0] == N:
      return True
  
  if N % 3 == 0:
    if 0 in list(caps.keys()) and len(caps) == 2:
      if caps[0] == N//3:
        return True
    elif len(caps) == 3:
      x, y, z = list(caps.keys())
    
      if x ^ y ^ z == 0:
        if caps[x] == caps[y] == caps[z] == N//3:
          return True


# A - XOR Circle
N = int(eval(input()))
a = list(map(int, input().split()))

# 帽子の情報をdictに入れる
caps = get_caps(a)

if is_match(caps):
  print('Yes')
else:
  print('No')
# Original solution
import collections as col
N=int(eval(input()))
A=[ai for ai in map(int,input().split())]
CA=col.Counter(A)
CA_KEYS=sorted(CA.keys())
#print(CA_KEYS)
for Ai in CA_KEYS:
    CA_Tmp={ai:0 for ai in CA_KEYS}
#    print()
    crnt=A[0]
    next=Ai
    CA_Tmp[crnt]=1
#    print(crnt, end=" ")
    if CA_Tmp[next] > CA[next]:
        continue
    Ans=True
    for j in range(1, N):
#        print(next,end=" ")
        if next in CA:
            CA_Tmp[next]+=1
            if CA_Tmp[next] > CA[next]:
                Ans=False
                break
            crnt,next=next,crnt^next
        else:
            Ans=False
            break
    if Ans==True:
        if next!=A[0]:
#            print("No!",next,"!=",A[0])
            Ans=False
        else:
            break


print(("Yes" if Ans==True else "No"))


# Optimized solution

import collections as col
N=int(eval(input()))
A=[ai for ai in map(int,input().split())]
Ans=False
CA=col.Counter(A)
if len(CA)==1 and 0 in CA:
    Ans=True
elif len(A)%3==0:
    if len(CA)==3:
        K=list(CA.keys())
        if (K[0]^K[1]==K[2]) and (CA[K[0]]==CA[K[1]]==CA[K[2]]):
            Ans=True
    elif len(CA)==2:
        K=list(sorted(CA.keys()))
        if CA[K[0]]*2==CA[K[1]]:
            Ans=True

print(("Yes" if Ans==True else "No"))
# Original solution
N = int(eval(input()))
*A, = list(map(int, input().split()))
setA = set(A)
if len(setA) == 3:
    a, b, c = list(setA)
    if a ^ c == b and a ^ b == c and b ^ c == a and A.count(a) == A.count(b) == A.count(c): print('Yes')
    else: print('No')
elif len(setA) <= 2:
    maxA = max(setA)
    if A.count(0) == A.count(maxA) or 2*A.count(0) == A.count(maxA): print('Yes')
    else: print('No')
else: print('No')

# Optimized solution
N = int(eval(input()))
*A, = list(map(int, input().split()))
setA = set(A)
if len(setA) == 3:
    a, b, c = list(setA)
    print(('Yes' if a ^ b ^ c == 0 and A.count(a) == A.count(b) == A.count(c) else 'No'))
elif len(setA) == 2: print(('Yes' if 2*A.count(0) == A.count(max(setA)) else 'No'))
elif len(setA) == 1: print(('Yes' if max(setA) == 0 else 'No'))
else: print('No')
# Original solution
N = int(eval(input()))
A = [int(a) for a in input().split()]
c = N-1
A.sort()
while c > 0:
    num = A[0]^A[c]
    pre_num = A[c]
    B = [A[0],A[c],num]
    while len(B) < N:
        box = num
        num = num^pre_num
        pre_num = box
        B.append(num)
        if pre_num not in A:
            break
    B.sort()
    if A == B:
        break
    c -= 1
if c > 0:
    print("Yes")
else:
    print("No")

# Optimized solution
N = int(eval(input()))
A = [int(a) for a in input().split()]
c = N-1
A.sort()
num = A[0]^A[c]
pre_num = A[c]
B = [A[0],A[c],num]
while len(B) < N:
    box = num
    num = num^pre_num
    pre_num = box
    B.append(num)
B.sort()
if A == B:
    print("Yes")
else:
    print("No")
# Original solution
N = int(eval(input()))
a = list(map(int, input().split()))
a_set = set(a)
if len(a_set) == 1:
    if a_set == {0}:
        print('Yes')
    else:
        print('No')
elif len(a_set) == 2:
    a_set = list(a_set)
    a0 = a.count(a_set[0])
    a1 = a.count(a_set[1])
    if N % 3 == 0 and (a0 == 2 * a1 or a1 == 2 * a0) and 0 in a_set:
        print('Yes')
    else:
        print('No')
elif len(a_set) == 3:
    a_set = list(a_set)
    flag = 0
    if a.count(a_set[0]) == a.count(a_set[1]) and a.count(a_set[0]) == a.count(a_set[2]):
        flag = 1
    if N % 3 == 0 and flag == 1 and a_set[0] ^ a_set[1] == a_set[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')


# Optimized solution
N = int(eval(input()))
a = list(map(int, input().split()))
a_set = set(a)
if len(a_set) == 1:
    if a_set == {0}:
        print('Yes')
    else:
        print('No')
elif len(a_set) == 2:
    a_set = list(a_set)
    a0 = a.count(a_set[0])
    a1 = a.count(a_set[1])
    if N % 3 == 0 and a1 == 2 * a0 and a_set[0] == 0:
        print('Yes')
    else:
        print('No')
elif len(a_set) == 3:
    a_set = list(a_set)
    flag = 0
    if a.count(a_set[0]) == a.count(a_set[1]) and a.count(a_set[0]) == a.count(a_set[2]):
        flag = 1
    if N % 3 == 0 and flag == 1 and a_set[0] ^ a_set[1] == a_set[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')
# Original solution
import itertools

N = int(eval(input()))
a = list(map(int ,input().split()))

def get_ans(a, N):
    ans = 'Yes'
    for l in list(itertools.permutations(a)):
        a_tmp = list(l)
        if a_tmp[0] != a[0]:
            continue
        a_tmp.extend(a_tmp[:2])

        for x in range(N):
            if int(bin(a_tmp[x]^a_tmp[x+2]), 0) != a_tmp[x+1]:
                ans = 'No'
                print(ans)
                return 'False'
    print(ans)
    return True

ret = get_ans(a, N)

# Optimized solution
import itertools

N = int(eval(input()))
a = list(map(int ,input().split()))

plus_set = set([ int(bin(c[0]^c[1]), 0) for c in (itertools.combinations(a,2))])
if set(a) == plus_set:
    print('Yes')
else:
    print('No')
# Original solution
a = int(eval(input()))
b = list(map(int, input().split()))
c = {}

for i in range(a):
    if b[i] not in c:
        c.setdefault(b[i], 1)
    else:
        c[b[i]] += 1

if len(c) == 3:
    f = list(c.values())
    for i in range(1, len(f)):
        if f[i] != f[i-1]:
            print("No")
            exit()
    g = list(c.keys())
    if g[0] ^ g[1] == g[2]:
        print("Yes")
    else:
        print("No")
elif len(c) == 2:
    f = list(c.values())
    if f[0] != f[1]*2 and f[0]*2 != f[1]:
        print("No")
        exit()
    g = list(c.keys())
    if g[0] == 0 or g[1] == 0:
        print("Yes")
    else:
        print("No")
elif len(c) == 1:
    g = list(c.keys())
    if g[0] == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")
    exit()


# Optimized solution
a = int(eval(input()))
b = list(map(int, input().split()))
e = {}
for i in b:
    if i not in e:
        e[i] = 1
    else:
        e[i] += 1
if len(e) > 3:
    print("No")
elif len(e) == 3:
    x, y, z = list(map(int, list(e.keys())))
    xx, yy, zz = list(map(int, list(e.values())))
    if x ^ y == z and y ^ z == x and z ^ x == y and xx == yy == zz:
        print("Yes")
    else:
        print("No")
elif len(e) == 2:
    x, y = list(map(int, list(e.keys())))
    xx, yy = list(map(int, list(e.values())))
    if (x == 0 and 2 * xx == yy) or (y == 0 and xx == 2 * yy):
        print("Yes")
    else:
        print("No")
elif len(e) == 1:
    x = list(map(int, list(e.keys())))[0]
    if x == 0:
        print("Yes")
    else:
        print("No")
# Original solution
N=int(eval(input()))
a=[int(i) for i in input().split()]
b=list(set(a))
if len(b)==1:
    if b[0]==0:
        print("Yes")
    else:
        print("No")
else:
    if N%3==0 and len(b)==3:
        D={b[0]:0,b[1]:0,b[2]:0}
        for i in range(N):
            D[a[i]]+=1
        if D[b[0]]==D[b[1]] and D[b[1]]==D[b[2]] and b[0]^b[1]==b[2]:
            print("Yes")
        else:
            print("No")
    else:
        if N%3==0 and len(b)==2:
            D={b[0]:0,b[1]:0}
            for i in range(N):
                D[a[i]]+=1
            if D[b[0]]==D[b[1]]*2:
                if b[0]^b[0]==b[1]:
                    print("Yes")
                else:
                    print("No")
            elif D[b[1]]==D[b[0]]*2:
                if b[1]^b[1]==b[0]:
                    print("Yes")
                else:
                    print("No")
            else:
                print("No")
        else:
            print("No")


# Optimized solution
N=int(eval(input()))
A=[int(i) for i in input().split()]
tmp=0
for i in range(N):
    tmp=tmp^A[i]
if tmp==0:
    print("Yes")
else:
    print("No")
# Original solution
from collections import defaultdict

n = int(eval(input()))
a = tuple(map(int, input().split()))

can = True
if n % 3 == 0:
    d = defaultdict(int)
    for aa in a:
        d[aa] += 1
    m = n // 3

    t = []
    for number, cnt in list(d.items()):
        if cnt % m != 0:
            can = False
            break
        else:
            for _ in range(cnt // m):
                t.append(number)
    else:
        if any(t[(0 + i) % 3] ^ t[(1 + i) % 3] != t[(2 + i) % 3] for i in range(3)):
            can = False

else:
    if any(aa != 0 for aa in a):
        can = False

print(('Yes' if can else 'No'))

# Optimized solution
def main():
    from collections import Counter

    n = int(eval(input()))
    *a, = list(map(int, input().split()))

    if n % 3 == 0:
        ctr = Counter(a)
        if len(ctr) == 1:
            print(('Yes' if 0 in ctr else 'No'))
            return

        elif len(ctr) == 2:
            print(('Yes' if ctr[0] == n // 3 else 'No'))
            return

        elif len(ctr) == 3:
            x = 0
            p = None
            for k, v in list(ctr.items()):
                if p is None:
                    p = v
                elif p != v:
                    print('No')
                    return
                x ^= k
            print(('Yes' if x == 0 else 'No'))
            return

        else:
            print('No')
            return

    else:
        print(('Yes' if all([x == 0 for x in a]) else 'No'))
        return


if __name__ == '__main__':
    main()
# Original solution
N=int(eval(input()))
A=list(map(int, input().split()))

a=A[0]
for i in range(N-1):
  a=a^A[i+1]
if a==0:
  print("Yes")
else:
  print("No")


# Optimized solution
N=int(eval(input()))
A=list(map(int, input().split()))

x=len(set(A))
if x==1:
  if A==[0]*N:
    print('Yes')
  else:
    print('No')
elif x==2:
  B=list(set(A))
  a,b=max(B),min(B)
  if b==0 and A.count(0)==(N//3):
    print('Yes')
  else:
    print('No')
elif x==3:
  B=list(set(A))
  a=max(B)
  c=min(B)
  b=sum(B)-a-c
  if A.count(a)==A.count(b) and A.count(b)==A.count(c):
    if a^b==c:
      print('Yes')
    else:
      print('No')
  else:
    print('No')
else:
  print('No')
# Original solution
from itertools import permutations

n = int(eval(input()))
line = list(map(int,input().split( )))

Flag = False

perm = list(permutations(list(range(n))))

for item in perm:
    flag = True
    for i in range(n):
        if line[item[i]] != line[item[(i-1)%n]] ^ line[item[(i+1)%n]]:
            flag = False
    if flag:
        Flag = True

if flag:
    print('Yes')
else:
    print('No')

# Optimized solution
n = int(eval(input()))
line = list(map(int,input().split( )))
s = list(set(line))

if n%3==0 and 0 in line and line.count(0)==n//3 and len(s)<=2:
    print('Yes')
elif  n%3==0 and len(s)==3 and s[0]^s[1]==s[2] and s[1]^s[2]==s[0] and line.count(s[0])==n//3 and line.count(s[1])==n//3:
    print('Yes')
elif s == [0]:
    print('Yes')
else:
    print('No')