CodeEff/ECCO huggingface dataset:
# Original solution
N,M = list(map(int,input().split()))
es = [[] for i in range(N)]
for i in range(M):
  a,b = list(map(int,input().split()))
  a,b = a-1,b-1
  es[a].append(b)
  es[b].append(a)

colors = [0 for i in range(N)]

def is_bipartite():
  stack = [(0,1)]
  while stack:
    v,color = stack.pop()
    colors[v] = color
    for to in es[v]:
      if colors[to] == color:
        return False
      if colors[to] == 0:
        stack.append((to, -color))
  return True

if is_bipartite():
  b = (sum(colors) + N) // 2
  w = N-b
  print((b*w - M))
else:
  all = N*(N-1) // 2
  print((all - M))

# Optimized solution
import sys
sys.setrecursionlimit(10**7)

N,M = list(map(int,input().split()))
es = [[] for i in range(N)]
for i in range(M):
  a,b = list(map(int,input().split()))
  a,b = a-1,b-1
  es[a].append(b)
  es[b].append(a)

colors = [0 for i in range(N)]

def dfs(v,color):
  colors[v] = color
  for to in es[v]:
    if colors[to] == color:
      return False
    if colors[to] == 0 and not dfs(to, -color):
      return False
  return True

def is_bipartite():
  return dfs(0,1)

if is_bipartite():
  b = (sum(colors) + N) // 2
  w = N-b
  print((b*w - M))
else:
  all = N*(N-1) // 2
  print((all - M))
# Original solution
N, M = list(map(int, input().split()))

edge = {}
for i in range(N):
  edge[repr(i+1)] = {}

answers = set()
pre = set()

def add_edge(a, b):
  if a == b or b in edge[a]:
    return
  edge[a][b] = edge[b][a] = 1
  answers.add((min(a,b), max(a,b)))
  adds = []
  for n1 in edge[a].keys():
    for n2 in edge[n1].keys():
      adds.append((n2, b))
    for n2 in edge[b].keys():
      adds.append((n1, n2))
  for n1 in edge[b].keys():
    for n2 in edge[n1].keys():
      adds.append((n2, a))
  for e in adds:
    add_edge(e[0], e[1])

for i in range(M):
  a, b = input().split()
  pre.add((min(a,b), max(a,b)))
  add_edge(a, b)

print(len(answers - pre))

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

edge = {}
for i in range(N):
  edge[repr(i+1)] = {}

answers = set()
pre = set()

def add_edge(a, b):
  edge[a][b] = edge[b][a] = 1
  answers.add((min(a,b), max(a,b)))
  adds = []
  for n1 in edge[a].keys():
    for n2 in edge[n1].keys():
      if n2 != b and b not in edge[n2]:
        adds.append((n2, b))
    for n2 in edge[b].keys():
      if n1 != n2 and n2 not in edge[n1]:
        adds.append((n1, n2))
  for n1 in edge[b].keys():
    for n2 in edge[n1].keys():
      if a != n2 and n2 not in edge[a]:
        adds.append((n2, a))
  for e in adds:
    add_edge(e[0], e[1])

for i in range(M):
  a, b = input().split()
  pre.add((min(a,b), max(a,b)))
  if b not in edge[a]:
    add_edge(a, b)

print(len(answers - pre))
# Original solution
from collections import deque

N, M = list(map(int, input().split()))
adj = [ [] for _ in range(N)]
clr = [-1 for _ in range(N)]

#グラフ構築
for _ in range(1,M+1):
  u, v = list(map(int, input().split()))
  u -= 1
  v -= 1
  adj[u].append((v,1))
  adj[v].append((u,1))

#二部グラフか否か判定  
vis = [0 for _ in range(N)]
q = deque([(0,0)])
is_bip = True
#print(clr)
while q:
  p, c = q.popleft()
  clr[p] = c
  vis[p] = 1
  for x, w in adj[p]:
    if vis[x] == 0:
      q.append((x,(w+c)%2))
      #print((x,(w+c)%2))
    else: 
      if (clr[x] + c) % 2 == 0:
        is_bip = False
        break
  if not is_bip:
    break
    
#ここから問題特有の処理
if is_bip:#二部グラフの場合
  apple = clr.count(0)
  orange = clr.count(1)
  #print(apple,orange,M)
  print((apple*orange-M))
  
else:#二部グラフでない場合
  print((N*(N-1)//2-M))
  

# Optimized solution
import sys

N, M = list(map(int, input().split()))
sys.setrecursionlimit(10**6)
I = [[] for _ in range(N)]
for i in range(M):
  a, b = list(map(int, input().split()))
  a -= 1
  b -= 1
  I[a].append(b)
  I[b].append(a)

C = [-1 for _ in range(N)] 
visited = set()

def DFS(p, c):
  C[p] = c
  flag = True
  for q in I[p]:
    #print(p,q)
    if C[q] == c:
      return False
    elif C[q] == -1:
      if not DFS(q, 1-c):
        return False
  return True

#print(DFS(0, 0))
#print(C)
print((C.count(0)*C.count(1)-M if DFS(0, 0) else N*(N-1)//2-M))
# Original solution
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(200000)

    N,M = list(map(int,input().split()))
    edges = [[]for _ in range(N+1)]
    for _ in range(M):
        a,b = list(map(int,input().split()))
        edges[a].append(b)
        edges[b].append(a)

    colors = [-1]*(N+1)
    def paint(n,p,c):
        ret = 1
        if colors[n]!=-1 and colors[n]!=c:
            ret = 0
        else:
            colors[n] = c
            for nx in edges[n]:
                if nx != p:
                    ret = min(ret,paint(nx,n,(c+1)%2))
        return ret

    def choose(n,k):
        import math
        return math.factorial(n)//(math.factorial(n-k)*math.factorial(k))
    res = paint(1,0,1)
    if res == 0:
        ans = choose(N,2)-M
    else:
        ans = colors.count(0)*(N-colors.count(0))-M

    print(ans)

main()


# Optimized solution
import sys
sys.setrecursionlimit(200000)

N,M = list(map(int,input().split()))
edges = [[]for _ in range(N+1)]
for _ in range(M):
    u,v = list(map(int,input().split()))
    edges[u].append(v)
    edges[v].append(u)

colors = [-1]*(N+1)
def choose(n,k):
    import math
    return math.factorial(n)//(math.factorial(n-k)*math.factorial(k))
def dfs(n,c):
    if colors[n] == -1:
        colors[n] = c
        for nx in edges[n]:
            dfs(nx,(c+1)%2)
    else:
        if colors[n] != c:
            print((choose(N,2)-M))
            exit()
dfs(1,0)
white = colors.count(0)
black = N - white
print((white*black-M))
# Original solution
import sys
sys.setrecursionlimit(200000)

N,M = list(map(int,input().split()))
edges = [[] for _ in range(N+1)]
for _ in range(M):
    a,b = list(map(int,input().split()))
    edges[a].append(b)
    edges[b].append(a)
n = len(edges)
colors = [-1]*(n+1)

def paint(v,c):
    if colors[v] == -1:
        colors[v] = c
        nxC = (c+1)%2
        for nxV in edges[v]:
            result = paint(nxV,nxC)
            if result == False:
                return result
    else:
        if colors[v] != c:
            return False
    return True
    
if paint(1,0):
    ans = colors.count(1)*colors.count(0)-M
else:
    def choose(n,k):
        import math
        return math.factorial(n)//(math.factorial(n-k)*math.factorial(k))
    ans = choose(N,2)-M
print(ans)

# Optimized solution
"""
奇数本の辺で成り立つ閉路があれば、全ての頂点同士を1本の辺で結ぶことができる。
そうでない場合は、奇数本の辺をたどってたどり着ける頂点同士は全て1本の辺で結ぶことができる。
奇数本の閉路があるかどうかを、どうやって判定するか？
二部グラフ判定を行う。
二部グラフ判定ってどうやるんだっけ？→となりのノードに違う色をつけていって、矛盾がなければ二部グラフ。矛盾があれば二部グラフじゃない。
"""
import sys
sys.setrecursionlimit(200000)
N,M = list(map(int,input().split()))
edges = [[] for _ in range(N+1)]
for _ in range(M):
    a,b = list(map(int,input().split()))
    edges[a].append(b)
    edges[b].append(a)

n = len(edges)
colors = [-1]*(n+1)
def judgeBiGragh(edges):
    def paint(v,c):
        if colors[v] == -1:
            colors[v] = c
            nxC = (c+1)%2
            for nxV in edges[v]:
                result = paint(nxV,nxC)
                if result == False:
                    return result
        else:
            if colors[v] != c:
                return False
        return True
    return paint(1,0)

def choose(n,k):
    import math
    return math.factorial(n)//(math.factorial(n-k)*math.factorial(k))
if judgeBiGragh(edges):
    cnt0 = colors.count(0)
    cnt1 = colors.count(1)
    ans = cnt0*cnt1 - M
else:
    ans = choose(N,2)-M

print(ans)
# Original solution
from functools import reduce
from operator import xor

R = lambda: list(map(int, input().split()))
 
n = int(eval(input()))
if n % 3:
    ans = 'YNeos'[any(R())::2]
else:
    a = sorted(R())
    m = n // 3
    if reduce(xor, a[::m]):
        ans = 'No'
    elif any(len(set(a[i:i + m])) > 1 for i in range(0, n, m)):
        ans = 'No'
    else:
        ans = 'Yes'
print(ans)


# Optimized solution
R = lambda: list(map(int, input().split()))
 
n = int(eval(input()))
if n % 3:
    ans = 'YNeos'[any(R())::2]
else:
    a = sorted(R())
    m = n // 3
    if a[0] ^ a[m] ^ a[2 * m]:
        ans = 'No'
    elif any(len(set(a[i:i + m])) > 1 for i in range(0, n, m)):
        ans = 'No'
    else:
        ans = 'Yes'
print(ans)
# Original solution
import itertools
n = int(eval(input()))
a = [int(i) for i in input().split()]

p = list(itertools.permutations(a,len(a)))
y = 0
for l in p:
	c = 0
	for i in range(len(l)-1):
		if l[i] != int(bin(l[i-1]^l[i+1]),0):
			c=1
			break
	if c==0:
		if l[-1] == int(bin(l[0]^l[-2]),0):
			y=1
			break
			
if y==1:
	print("Yes")
else:
	print("No")

# Optimized solution
n = int(eval(input()))
a = [int(i) for i in input().split()]
xor = []
for i in range(len(a)):
	for k in range(i,len(a)):
		xor.append(int(bin(a[i]^a[k]),0))
for i in a:
	if i not in xor:
		print("No")
		exit()
print("Yes")
# Original solution
import random
 
n = int(eval(input()))
a = [int(i) for i in input().split()]
 
rc = 0
while rc != 1000:
	c = 0
	for i in range(len(a)-1):
		if a[i] != int(bin(a[i-1]^a[i+1]),0):
			c=1
			random.shuffle(a)
			rc+=1
			break
	if c==0:
		if a[-1] != int(bin(a[0]^a[-2]),0):
			random.shuffle(a)
			rc+=1
		else:
			print("Yes")
			exit()
print("No")

# Optimized solution
n = int(eval(input()))
a = [int(i) for i in input().split()]
sum = 0
for i in a:
	sum^=i
if sum == 0:
	print("Yes")
else:
	print("No")
# Original solution
n=int(eval(input()))
a=[int(x) for x in map(int,input().split()[:n])]
ret=a[0]
for x in range(1,n):
    ret= a[x] ^ ret
if ret==0:
    print("Yes")
else:
    print("No")

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
ret=a[0]
for x in range(1,n):
    ret=a[x]^ret
if ret==0:
    print("Yes")
else:
    print("No")
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

import copy
hats = A[:]

import queue
q = queue.Queue()

for i, h1 in enumerate(hats):
    hats2 = hats[i+1:]
    for j, h2 in enumerate(hats2):
        hats3 = hats2[j+1:]
        for h3 in hats3:
            set_hats = set(hats)
            set_hats.discard(h1)
            set_hats.discard(h2)
            set_hats.discard(h3)
            q.put({'top': h1, 'three': [h1, h2, h3], 'set_hats': set_hats})
            q.put({'top': h1, 'three': [h1, h3, h2], 'set_hats': set_hats})
            
ans = 'No'
while not q.empty():
    data = q.get()
    #print(data)
    three = data['three']
    
    if three[0] ^ three[2] != three[1]:
        continue
       
    top = data['top']
    if top == None:
        ans = 'Yes'
        break
    
    set_hats = data['set_hats']
    if len(set_hats) == 0:
        three = three[1:] + [top]
        top = None
        q.put({'top': top, 'three': three, 'set_hats': set_hats})
    else:
        for s in set_hats:
            tmp = copy.copy(set_hats)
            tmp.discard(s)
            three = three[1:] + [s]
            q.put({'top': top, 'three': three, 'set_hats': tmp})
        
print(ans)

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

hats = A[:]

from collections import defaultdict
d = defaultdict(lambda: {})

for i, h1 in enumerate(hats):
    hats2 = hats[i+1:]
    for j, h2 in enumerate(hats2):
        d[h1][h2] = h1^h2
        d[h2][h1] = h1^h2
    
    
def dfs(now1, now2, used):
    if len(used) == N:
        return True
    
    now3 = d[now1][now2]
    if d[now3] == {}:
        return False
    
    used = used[:] + [now2]
    for s in d[now3]:
        if d[now3][s] == now2:
            continue
        if dfs(now3, s, used):
            return True
        
    return False

ans = False
for s in d[hats[0]]:
    tmp = dfs(hats[0], s, [])
    if tmp == True:
        ans = True
        break
        
if ans:
    print('Yes')
else:
    print('No')
# Original solution
import copy

N = eval(input())
A = input().split()
n = int(N)
Int_A = [int(a) for a in A]

result = [Int_A[0]]
Int_A.remove(Int_A[0])


def check(a):
    if len(Int_A) == 1:
        if result[0] == Int_A[0] ^ a:
            print("Yes")
            exit()
        return []

    res = []
    co_other = copy.deepcopy(Int_A)
    for o in Int_A:
        co_other.remove(o)
        if a ^ o in co_other:
            res.append(o)
        co_other.append(o)
    del co_other

    return res


def deep_check(depth):

    resp = check(result[depth - 1])

    if len(resp) == 0:
        depth -= 1
        return

    for k in resp:
        result.append(k)
        Int_A.remove(k)
        depth += 1
        deep_check(depth)
        result.remove(k)
        Int_A.append(k)
    depth -= 1
    return


deep_check(1)
print('No')




# Optimized solution
# import copy
#
N = eval(input())
A = input().split()
n = int(N)
Int_A = [int(a) for a in A]

k = 0

for a in Int_A:
    k ^= a

if k == 0:
    print("Yes")
else:
    print("No")


#
# result = [Int_A[0]]
# Int_A.remove(Int_A[0])
#
#
# def check(a):
#     if len(Int_A) == 1:
#         if result[0] == Int_A[0] ^ a:
#             print("Yes")
#             exit()
#         return []
#
#     res = []
#     co_other = copy.deepcopy(Int_A)
#     for o in Int_A:
#         co_other.remove(o)
#         if a ^ o in co_other:
#             res.append(o)
#         co_other.append(o)
#     del co_other
#
#     return res
#
#
# def deep_check(depth):
#
#     resp = check(result[depth - 1])
#
#     if len(resp) == 0:
#         depth -= 1
#         return
#
#     for k in resp:
#         result.append(k)
#         Int_A.remove(k)
#         depth += 1
#         deep_check(depth)
#         result.remove(k)
#         Int_A.append(k)
#     depth -= 1
#     return
#
#
# deep_check(1)
# print('No')
# Original solution
import sys
input = sys.stdin.readline
from collections import Counter

N = int(eval(input()))

c = Counter((int(x) for x in input().split()))

# 0がある場合
# 0,x,x,0,x,x
# あるいは
# 0,0,0,0 (any length is ok)

if c[0] > 0:
    if len(c) == 1:
        bl = True
    else:
        if len(c) > 2:
            bl = False
        else:
            bl = (N == 3 * c[0])
else:
    # 0がない場合
    # x,y,z,x,y,z で3つとも異なる
    se = set(c.keys())
    if len(se) != 3:
        bl = False
    else:
        bl = True
        xor = 0
        for key in se:
            xor ^= key
            if c[key] * 3 != N:
                bl = False
        if xor != 0:
            bl = False

answer = 'Yes' if bl else 'No'
print(answer)

# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

"""
・a,b,a+b,a,b,a+b,...
・0,a,a,0,a,a,...
・0,0,0,0,0,0,...
"""

N,*A = list(map(int,read().split()))

def solve(N,A):
    if all(x == 0 for x in A):
        return True
    q,r = divmod(N,3)
    if r:
        return False
    from collections import Counter
    counter = Counter(A)
    n = len(counter)
    if n == 1:
        return False
    if n == 2:
        a,b = list(counter.keys())
        if a > b:
            a,b = b,a
        if a != 0:
            return False
        # 0,b
        if counter[0] != N//3:
            return False
        return True
    if n == 3:
        a,b,c = list(counter.keys())
        for x in [a,b,c]:
            if counter[x] != q:
                return False
        return a^b^c == 0

answer = 'Yes' if solve(N,A) else 'No'
print(answer)
# Original solution
from collections import defaultdict

n = int(eval(input()))
a = list(map(int, input().split()))
d = defaultdict(int)
if all([not i for i in a]):
    print("Yes")
else:
    for i in a[1:]:
      d[i] += 1
    now1,now2 = a[0],0
    ans = [now1]
    for i in a[1:]:
      xor = now1^i
      d[i] -= 1
      d[xor] -= 1
      if d[xor] >= 0:
        now1, now2 = i, xor
        ans.append(now1)
        ans.append(now2)
        break
      d[i] += 1
      d[xor] += 1        
    else:
      print("No")
      exit()
    for i in range(n-3):
      xor = now1^now2
      d[xor] -= 1
      if d[xor] >= 0:
        now1, now2 = now2, xor
        ans.append(now2)
        continue
      else:
        print("No")
        exit()
    else:
      if now1^now2 == a[0]:
        print("Yes")
      else:
        print("No")
      exit()


# Optimized solution
from collections import defaultdict

n = int(eval(input()))
a = list(map(int, input().split()))
d = defaultdict(int)
if True:
    for i in a[1:]:
      d[i] += 1
    now1,now2 = a[0],0
    for i in a[1:]:
      xor = now1^i
      d[i] -= 1
      d[xor] -= 1
      if d[xor] >= 0:
        now1, now2 = i, xor
        break
      d[i] += 1
      d[xor] += 1        
    else:
      print("No")
      exit()
    for i in range(n-3):
      xor = now1^now2
      d[xor] -= 1
      if d[xor] >= 0:
        now1, now2 = now2, xor
      else:
        print("No")
        exit()
    else:
      if now1^now2 == a[0]:
        print("Yes")
      else:
        print("No")
      exit()
# Original solution
import collections
N = int(eval(input()))
a = list(map(int,input().split()))
B = collections.Counter(a)
k = list(B.keys())
v = list(B.values())

if len(B) == 3 and k[0]^k[1]^k[2] == 0 and v[0] == v[1] == v[2]:
    print("Yes")
elif len(B) == 2 and 0 in k and (v[0] == 2*v[1] or v[1] == 2*v[0]):
    print("Yes")
elif len(B) == 1 and 0 in k:
    print("Yes")
else: print("No")

# Optimized solution
import collections
N = int(eval(input()))
a = list(map(int,input().split()))
B = collections.Counter(a)
k = list(B.keys())
v = list(B.values())

ans = "Yes"
if len(B) == 3 and k[0]^k[1]^k[2] == 0 and v[0] == v[1] == v[2]: pass
elif len(B) == 2 and 0 in k and (v[0] == 2*v[1] or v[1] == 2*v[0]): pass
elif len(B) == 1 and 0 in k: pass
else: ans = "No"
print(ans)
# Original solution
from bisect import bisect_left as bl
from copy import deepcopy as dc
N = int(eval(input()))
Al = sorted(list(map(int, input().split())))
#print(Al)
q = -1
r = -1
for i in range(1, N - 1):
  A = dc(Al)
  #print(A)
  p = A.pop(0)
  temp = p ^ A[i]
  index = bl(A, temp)
  if index >= N - 1:
    continue
  if temp == A[index]:
    r = A.pop(i)
    q = A.pop(index)
    
    for j in range(1, N - 2):
      temp = q ^ r
      index = bl(A, temp)
      if temp == A[index]:
        t = r + 0
        if i == N - 4:
          r = p
        else:
          r = A.pop(index)
        q = t
      else:
        q = -1
        r = -1
        break
        
    
if q == -1:
  print("No")
  exit(0)
else:
  print("Yes")

# Optimized solution
N = int(eval(input()))
Al = list(map(int, input().split()))
p = Al[0]
for i in range(1, N):
  p = p ^ Al[i]
if p == 0:
  print("Yes")
else:
  print("No")
# Original solution
N = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
flag = True
if len(set(a)) == 1 and a[0] == 0:
    #print('Yes')
    pass
elif N % 3 == 0:
    if len(set(a)) == 3:
        b = list(set(a))
        c = []
        for i in b:
            c.append(a.count(i))
        if a[0] != 0 and c[0] == c[1] and  c[1] == c[2] and c[2] == N//3 and b[0]^b[1]^b[2] == 0:
            #print('Yes')
            pass
        else:
            #print('No')
            flag = False
    elif len(set(a)) == 2:
        if a[0] == 0 and a.count(a[0])*2 == a.count(a[N-1]) and a.count(a[N-1]) == N//3*2:
            #print('Yes')
            pass
        else:
            #print('No')
            flag = False
    else:
        #print('No')
        flag = False
else:
    #print('No')
    flag = False
if flag:
    print('Yes')
else:
    print('No')

# Optimized solution
N = int(eval(input()))
a = list(map(int,input().split()))
now = 0
for i in range(N):
    now ^= a[i]
if now == 0:
    print('Yes')
else:
    print('No')
# Original solution
N=int(eval(input()))
a= list(map(int, input().split()))
a.sort()
b=[None]*N
b[0]=a[0]
A=0
for i in range(N-1,0,-1):
  b[1]=a[i]
  for j in range(2,N):
    b[j]=b[j-1]^b[j-2]
    if b[j] not in a:
      break
  else:
    b.sort()
    if a==b:
      A=1
      break
if A==1:
  print("Yes")
else:
  print("No")


# Optimized solution
N=int(eval(input()))
a=list(map(int,input().split()))
t=0
for i in a:
    t=t^i
print(("No" if t else "Yes"))
# Original solution
import itertools
def permutations(iterable, r=None):
    pool = tuple(iterable)
    n = len(pool)
    ff = False
    r = n if r is None else r
    for indices in itertools.product(list(range(n)), repeat=r):
        if len(set(indices)) == r:
            p = tuple(pool[i] for i in indices)
            for i in range(0, n):
                if i == 0:
                    ff = checkXOR(p[n-1],p[i],p[i+1])
                elif i == n-1:
                    ff = checkXOR(p[i-1],p[i],p[0])
                else:
                    ff = checkXOR(p[i-1],p[i],p[i+1])
                if ff:
                    break
        if ff:
            break
    return ff

def checkXOR(a, b, c):
    if bin(b) == bin(a ^ c):
        return False
    else:
        return True
    
n = int(eval(input()))
a = list(map(int, input().split()))
ff = permutations(a)
    
if ff:
    print("No")
else:
    print("Yes")

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

for i in range(n):
  aa = aa ^ a[i]

if aa == 0:
  print("Yes")
else:
  print("No")
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
assert len(A) == N

class multiset:
    def __init__(self, L):
        self.dic = {}
        for a in L:
            if a not in self.dic:
                self.dic[a] = 0
            self.dic[a] += 1
    def has(self, x):
        return x in self.dic and self.dic[x] > 0
    def remove(self, x):
        if self.has(x):
            self.dic[x] -= 1

def check(x, y):
    a = x
    S = multiset(A)
    S.remove(x)
    S.remove(y)
    for i in range(N - 2):
        z = (x ^ y)
        if not S.has(z):
            return False
        S.remove(z)
        x, y = y, z
    return a == x ^ y

yes = any(check(A[0], a) for a in A[1:])
print(('Yes' if yes else 'No'))

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

def yes():
    S = set(A)
    if A.count(0) == N:
        return True
    if N % 3 != 0:
        return False
    if len(S) == 3:
        a, b, c = tuple(S)
        return all(A.count(x) == N // 3 for x in S) and a ^ b == c
    if len(S) == 2:
        a, b = tuple(S)
        return (a == 0 or b == 0) and A.count(0) == N // 3

print(('Yes' if yes() else 'No'))
# Original solution
n,a=int(eval(input())),sorted(list(map(int,input().split())));b=set(a);l=len(b);print(("Yes"if(l==3and b.pop()^b.pop()==b.pop()and n%3==0and a[n//3-1]!=a[n//3]and a[n//3*2-1]!=a[n//3*2])or(l==1and a[0]==0)or(l==2and a[0]==0and n%3==0and a[n//3-1]!=a[n//3])else"No"))

# Optimized solution
n,a=int(eval(input())),0
for i in list(map(int,input().split())):a^=i
print(("Yes"if a==0else"No"))
# Original solution
N = int(eval(input()))
a_list = list(map(int,input().split()))


from collections import Counter
a_dict = Counter(a_list)

start = a_list[0]
# 数を減らさない。
# a_dict[a] -= 1

a_keys = list(a_dict.keys())

def check():
    for a1 in a_keys:
#         print("for1",start,a1)
        a0 = start
        tmp_dict = a_dict.copy()
#         tmp_dict[a1] -= 1
        for i in range(N):
#             print(" for2",i,a0,a1)
#             print(tmp_dict)
            next_a = int(bin(a0^a1), 0)
            if not next_a in tmp_dict:
#                 print(next_a," not in dict")
                break
            if tmp_dict[next_a] <= 0:
                tmp_dict.pop(next_a)
                break
            a0 = a1
            a1 = next_a
            tmp_dict[next_a] -= 1
#             if tmp_dict[next_a] == 0:
#                 tmp_dict.pop(next_a)
            if i == N-1:
                return True
    return False

if check():
    print("Yes")
else:
    print("No")

# Optimized solution
from collections import Counter
N = int(eval(input()))
a_list = list(map(int,input().split()))

l = len(set(a_list))

def check():
    counter = Counter(a_list)
    if l == 1:
        if a_list[0] == 0:
            return True
        return False
    if l == 2:
        if counter[0] == N/3:
            return True
        return False
    if l == 3:
        x,y,z = set(a_list)
        if int(bin(x^y^z), 0) == 0 and set(list(counter.values()))==set([N/3]):
            return True
        return False
    return False

if check():
    print("Yes")
else:
    print("No")