Problem:
 Score : 300 points    Problem Statement Snuke has N hats. The i -th hat has an integer a_i written on it.  There are N camels standing in a circle.
Snuke will put one of his hats on each of these camels.  If there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print Yes ; otherwise, print No .   The bitwise XOR of the numbers written on the hats on both adjacent camels is equal to the number on the hat on itself.    What is XOR? The bitwise XOR x_1 \oplus x_2 \oplus \ldots \oplus x_n of n non-negative integers x_1, x_2, \ldots, x_n is defined as follows:

- When x_1 \oplus x_2 \oplus \ldots \oplus x_n is written in base two, the digit in the 2^k 's place ( k \geq 0 ) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k 's place is odd, and 0 if that count is even.

For example, 3 \oplus 5 = 6 .      Constraints  All values in input are integers.  3 \leq N \leq 10^{5}  0 \leq a_i \leq 10^{9}         Input Input is given from Standard Input in the following format:  N  a_1  a_2  \ldots  a_{N}       Output Print the answer.        Sample Input 1 3
1 2 3      Sample Output 1 Yes   If we put the hats with 1 , 2 , and 3 in this order, clockwise, the condition will be satisfied for every camel, so the answer is Yes .        Sample Input 2 4
1 2 4 8      Sample Output 2 No   There is no such way to distribute the hats; the answer is No .

Solution (Python):
def main():
    n = int(input())
    from collections import Counter
    ls = Counter(map(int, input().split()))
    print('YNeos'[not check(n, ls)::2])

def check(n, ls):
    key = list(ls.keys())
    val = list(ls.values())
    l = len(key)
    if key[0] == 0 and val[0] == n:
        return True
    elif l in [2, 3] and n % 3 == 0:
        if l == 2:
            if key[0] ^ key[1] in key and (val[0] == val[1]*2 or val[0]*2 == val[1]): return True
        elif l == 3:
            for v in val:
                if v != n / 3: return False
            if key[0] ^ key[1] == key[2] or key[1] ^ key[2] == key[0] or key[2] ^ key[0] == key[1]: return True
        return False
    else:
        return False

if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter

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

flag="No"

count_by_kw = Counter()
for i in range(n):
    count_by_kw[a[i]]+=1

if count_by_kw.get(0) == n:
    flag="Yes"

if count_by_kw.get(0) == n/3 and len(count_by_kw.keys())==2:
    flag="Yes"

cl=list(count_by_kw.values())
ck=list(count_by_kw.keys())

if len(cl)==3:
    if cl[0] == cl[1] and cl[1] == cl[2]:
        xor = ck[0]^ck[1]^ck[2]
        if xor == 0:
            flag="Yes"
        
print(flag)

Solution (Python):
n=int(input())
a=[int(x) for x in input().split()]
b=0
for i in a:
  b=b^i
if b==0:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
A = list(set(a))
A.sort()
ans = "No"
if len(A) == 1:
    if A[0] == 0:
        ans = "Yes"
elif len(A) == 2:
    if A[0] == 0:
        if a.count(A[1]) == 2* (n // 3) :
            ans = "Yes"
elif len(A) == 3:
    if A[0]^A[1]^A[2] == 0:
        if a.count(A[0]) == n//3:
            if a.count(A[1]) == n//3:
                if a.count(A[2]) == n//3:
                    ans = "Yes"
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline


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


import collections

c = collections.Counter(a)

klist = list(c.keys())
vlist = list(c.values())

if len(klist) == 1 and klist[0] == 0:
    print('Yes')
    sys.exit()

if len(klist) == 2:
    if (klist[0] == 0 and vlist[0] == N/3) or (klist[1] == 0 and vlist[1] == N/3):
        print('Yes')
        sys.exit()

if not len(klist) == 3:
    print('No')
    sys.exit()

if not (vlist[0] == vlist[1] and vlist[1] == vlist[2]):
    print('No')
    sys.exit()

if not (klist[0] ^ klist[1] ^ klist[2] == 0):
    print('No')
    sys.exit()

print('Yes')

Solution (Python):
from collections import Counter
N=int(input())
A=Counter(list(map(int,input().split())))
B=list(A.values())
C=list(A.keys())
if len(B)>4:print("No")
elif len(B)==3:
    if B[0]==B[1]==B[2]:
        if C[0]^C[1]==C[2] or C[1]^C[2]==C[0] or C[2]^C[0]==C[1]:print("Yes")
        else:print("No")
    else:print("No")
elif len(B)==2:
    if 0 in C and A[0]*2 in B:print("Yes")
    else:print("No")
else:
    if 0 in C:print("Yes")
    else:print("No")

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a_unique = list(set(a))
a_unique.sort()

if len(a_unique) == 1 and a[0] == 0:
    ans = 'Yes'
elif len(a) % 3 == 0 :
    if len(a_unique) == 3:
        if bin(a_unique[0]) == bin(a_unique[1] ^ a_unique[2]) and bin(a_unique[1]) == bin(a_unique[0] ^ a_unique[2]) and bin(a_unique[2]) == bin(a_unique[1] ^ a_unique[0]) and a.count(a_unique[1]) == N//3 and a.count(a_unique[0]) == N//3 :
            ans = 'Yes'
        else:
            ans = 'No'
    elif len(a_unique) == 2:
        if a_unique[0] == 0 and a.count(a_unique[1]) == N//3 * 2:
            ans = 'Yes'
        else:
            ans = 'No'
    else:
        ans = 'No'
else:
    ans = 'No'

print(ans)

Solution (Python):
n=int(input())
*a,=map(int,input().split())
s=list(set(a))
s.sort()
ans="No"
if len(s)==1:
  if 0 in s:
    ans="Yes"
elif len(s)==2:
  if a.count(0)*2==a.count(s[1]):
    ans="Yes"
elif len(s)==3 and a.count(s[0])==a.count(s[1])==a.count(s[2]) and s[0]^s[1]^s[2]==0:
  ans="Yes"
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
t = 0
for i in a:
    t = t^i
if t==0:print("Yes")
else:print("No")

Solution (Python):

from functools import reduce
from operator import xor


def main():
    n = int(input())
    A = tuple(map(int, input().rstrip().split()))
    ans = reduce(xor, A)
    print("Yes" if ans == 0 else "No")


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    """
    a1 ^ a3 = a2 <-> A1 ^ a2 ^ a3 = 0
    a1~4 -> a1 ^ a2 ^ a3 = a2 ^ a3 ^ a4 = 0 -> a1 = a4
    Thus, 1) all 0
          2) 2n/3 of A: x, n/3: 0
          3) x, y, z n/3 each (x ^ y ^ z = 0)
    """
    n = int(input())
    A = tuple(map(int, input().rstrip().split()))
    S = set(A)
    if S == {0}:  
        flg = 1
    elif len(S) == 2 and A.count(0) == n // 3:  
        flg = 1
    elif len(S) == 3:
        a, b, c = S
        if A.count(a) == A.count(b) == A.count(c) and a ^ b ^ c == 0:  
            flg = 1
        else:
            flg = 0
    else:
        flg = 0
    print("Yes" if flg else "No")


if __name__ == "__main__":
    main()

Solution (Python):
a = int(input())
b = list(map(int,input().split()))
c = 0
for i in b:
    c ^= i
if c == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
import collections
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in a:
    ans ^= i
if ans ==0:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())

def xor(x,y):
    return ((x and y) or (not (x or y)))

def change(x):
    da=[True for i in range(31)]
    for i in da:
        da[i]=bool(x%2)
        x/=2
    return da

da=list(map(int,input().split()))
di={}
ans=False
for i in da:
    if i in di.keys():
        di[i]+=1
    else:
        di[i]=1
va=list(di.values())
ke=list(di.keys())
if len(di)==3:
    if va[0]==va[1] and va[0]==va[2]:
        if ke[0]^ke[1]==ke[2]:
            ans=True
elif len(di)==2:
    if va[0]==va[1]*2 or va[1]==va[0]*2:
        if ke[0]==0 or ke[1]==0:
            ans=True

elif len(di)==1:
    if ke[0]==0:
        ans=True
if ans:
    print('Yes')
else:
    print('No')

Solution (Python):
import collections
N = int(input())
A = [int(i) for i in input().split()]

if set(A) == {0}:
    print('Yes')
    exit()


if N % 3 != 0:
    print('No')
    exit()

c = collections.Counter(A)

for v in c.values():
    if v % (N//3) != 0:
        print('No')
        exit()


if len(c) == 2 and c.most_common()[1][0] == 0 and c.most_common()[0][0] ^ 0 == c.most_common()[0][0]:
    print('Yes')
    exit()
elif len(c) == 3 and \
        (c.most_common()[0][0] ^ c.most_common()[1][0] ^ c.most_common()[2][0]) == 0:
    print('Yes')
    exit()


else:
    print('No')

Solution (Python):
from sys import stdin


def main():
    N = int(input())
    a_list = [int(x) for x in stdin.readline().rstrip().split()]
    a_set = set(a_list)

    if len(a_set) == 1:
        if sum(a_set) == 0:
            print("Yes")
        else:
            print("No")

    elif len(a_set) == 2:
        a_1, _2 = sorted(a_set)
        if a_1 == 0:
            if a_list.count(a_1) * 3 == N:
                print("Yes")
            else:
                print("No")
        else:
            print("No")

    elif len(a_set) == 3:
        a_1, a_2, a_3 = a_set
        if a_list.count(a_1) == a_list.count(a_2) and a_list.count(a_2) == a_list.count(a_3):
            if a_1 ^ a_2 == a_3:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    else:
        print("No")


if __name__ == "__main__":
    main()

Solution (Python):
from sys import stdin


def main():
    _ = int(input())
    a_lists = [int(x) for x in stdin.readline().rstrip().split()]
    z = 0

    for a in a_lists:
        z ^= a

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


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
b = list(set(a))

if n%3 == 0:
    if len(b) == 1:
        if a[0] == 0:
            print('Yes')
        else:
            print('No')
    elif len(b) == 2:
        if a.count(0) == n//3:
            print('Yes')
        else:
            print('No')
    elif len(b) == 3:
        if b[0]^b[1] == b[2]:
            if a.count(b[0]) == a.count(b[1]) == a.count(b[2]):
                print('Yes')
            else:
                print('No')
        else:
            print('No')
    else:
        print('No')
elif n%3 == 1:
    if b == [0]:
        print('Yes')
    else:
        print('No')
else:
    if b==[0]:
        print('Yes')
    else:
        print('No')

Solution (Python):
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))

cnt = defaultdict(int)
for a in A:
    cnt[a] += 1

if cnt[0] == N:
    print('Yes')
    exit()
if N % 3:
    print('No')
    exit()

nums = []
for p, q in cnt.items():
    for i in range(q // (N // 3)):
        nums.append(p)

if len(nums) == 3 and (nums[0] ^ nums[1] ^ nums[2] == 0):
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
numbers = list(map(int, input().split()))

x = 0
for num in numbers:
  x ^= num
  
if x == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
numbers = list(map(int, input().split()))

x = 0
for num in numbers:
  x ^= num
  
if x == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
from collections import Counter
N = int(input())
a_array = list(map(int, input().split()))

a = Counter(a_array)

if len(a) == 1 and a[0] == N:
    print("Yes")
    exit()

if len(a) == 2 and N % 3 == 0 and a[0] == N // 3:
    print("Yes")
    exit()


if len(a) == 3:
    i_array = []
    for i, x in a.items():
        i_array.append(i)
        if x != N // 3:
            print("No")
            exit()
    else:
        if i_array[0] ^ i_array[1] == i_array[2]:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
else:
    print("No")
    exit()

Solution (Python):
a = int(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 = map(int, e.keys())
    xx, yy, zz = map(int, 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 = map(int, e.keys())
    xx, yy = map(int, 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, e.keys()))[0]
    if x == 0:
        print("Yes")
    else:
        print("No")

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
D=dict()
for i in range(N):
    if a[i] in D:
        D[a[i]]+=1
    else:
        D[a[i]]=1
L=list(D.items())
L.sort()


if len(L)==1:
    if L[0][0]==0:
        print("Yes")
        exit()
elif len(L)==2:
    if L[0][0]==0 and L[1][1]==L[0][1]*2:
        print("Yes")
        exit()
elif len(L)==3:
    
    if L[0][1]==L[1][1] and L[1][1]==L[2][1]:
        
        if L[1][0]==L[0][0]^L[2][0] and L[2][0]==L[1][0]^L[0][0] and L[0][0]==L[1][0]^L[2][0]:
            print("Yes")
            exit()
print("No")

Solution (Python):
def main():

    """ convenient functions
    
    
    
    
    
    """

    """convenient decorator
    
    
        
        
        
        
        
        
        
        
        
        
    """
    
    
    import sys
    sys.setrecursionlimit(10**7)
    from itertools import accumulate, combinations, permutations, product 
    
    from math import factorial, ceil, floor, sqrt
    def factorize(n):
        """return the factors of the Arg and count of each factor
        
        Args:
            n (long): number to be resolved into factors
        
        Returns:
            list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
        """
        fct = []  
        b, e = 2, 0  
        while b * b <= n:
            while n % b == 0:
                n = n // b
                e = e + 1
            if e > 0:
                fct.append((b, e))
            b, e = b + 1, 0
        if n > 1:
            fct.append((n, 1))
        return fct
    def combinations_count(n, r):
        """Return the number of selecting r pieces of items from n kinds of items.
        
        Args:
            n (long): number
            r (long): number
        
        Raises:
            Exception: not defined when n or r is negative
        
        Returns:
            long: number
        """
        
        if n < 0 or r < 0:
            raise Exception('combinations_count(n, r) not defined when n or r is negative')
        if n - r < r: r = n - r
        if r < 0: return 0
        if r == 0: return 1
        if r == 1: return n
        numerator = [n - r + k + 1 for k in range(r)]
        denominator = [k + 1 for k in range(r)]
        for p in range(2,r+1):
            pivot = denominator[p - 1]
            if pivot > 1:
                offset = (n - r) % p
                for k in range(p-1,r,p):
                    numerator[k - offset] /= pivot
                    denominator[k] /= pivot
        result = 1
        for k in range(r):
            if numerator[k] > 1:
                result *= int(numerator[k])
        return result
    def combinations_with_replacement_count(n, r):
        """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
        
        Args:
            n (long): number
            r (long): number
        
        Raises:
            Exception: not defined when n or r is negative
        
        Returns:
            long: number
        """
        if n < 0 or r < 0:
            raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
        elif n == 0:
            return 1
        else:
            return combinations_count(n + r - 1, r)
    from bisect import bisect_left, bisect_right
    from collections import deque, Counter, defaultdict 
    from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest 
    from copy import deepcopy, copy 
    import operator
    from operator import itemgetter
    
    
    from functools import reduce, lru_cache
    def chmin(x, y):
        """change minimum
        if x > y, x = y and return (x, True).
        convenient when solving problems of dp[i]
        
        Args:
            x (long): current minimum value
            y (long): potential minimum value
        
        Returns:
            (x, bool): (x, True) when updated, else (x, False)
        """
        if x > y:
            x = y
            return (x, True)
        else:
            return (x, False)
    def chmax(x, y):
        """change maximum
        if x < y, x = y and return (x, True).
        convenient when solving problems of dp[i]
        
        Args:
            x (long): current maximum value
            y (long): potential maximum value
        
        Returns:
            (x, bool): (x, True) when updated, else (x, False)
        """
        if x < y:
            x = y
            return (x, True)
        else:
            return (x, False)

    from fractions import gcd 
    def gcds(numbers):
        return reduce(gcd, numbers)
    def lcm(x, y):
        return (x * y) // gcd(x, y)
    def lcms(numbers):
        return reduce(lcm, numbers, 1)

    
    
    INF = 10 ** 18
    MOD = 10 ** 9 + 7
    modpow = lambda a, n, p = MOD: pow(a, n, p) 
    def modinv(a, p = MOD):
        
        
        return modpow(a, p-2, p)
    def modinv_list(n, p = MOD):
        if n <= 1:
            return [0,1][:n+1]
        else:
            inv_t = [0,1]
            for i in range(2, n+1):
                inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
            return inv_t
    def modfactorial_list(n, p = MOD):
        if n == 0:
            return [1]
        else:
            l = [0] * (n+1)
            tmp = 1
            for i in range(1, n+1):
                tmp = tmp * i % p
                l[i] = tmp
            return l
    def modcomb(n, k, fac_list = [], p = MOD):
        
        
        from math import factorial
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        if len(fac_list) <= n:
            a = factorial(n) % p
            b = factorial(k) % p
            c = factorial(n-k) % p
        else:
            a = fac_list[n]
            b = fac_list[k]
            c = fac_list[n-k]
        return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p
    def modadd(a, b, p = MOD):
        return (a + b) % MOD
    def modsub(a, b, p = MOD):
        return (a - b) % p
    def modmul(a, b, p = MOD):
        return ((a % p) * (b % p)) % p
    def moddiv(a, b, p = MOD):
        return modmul(a, modpow(b, p-2, p))

    class UFT:
        """union find tree class
        TODO: fix this description...
        how to use (example):
        >>  UF = UFT(N) 
        >>  if UF.find_root(a) == UF.find_root(b):
        >>      do something
        >>  else:
        >>      do something
        >>      UF.unite(a, b)
        """
        def __init__(self, N):
            self.root = [-1] * (N+1)
            self.rank   = [0]  * (N+1)
            self.connected_num = [1] * (N+1)
    
        def find_root(self,x):
            root = self.root
            while root[x] != -1:
                x = root[x]
            return x
    
        def unite(self,x,y):
            root = self.root
            rank = self.rank
            connected_num = self.connected_num
            find_root = self.find_root
    
            x = find_root(x)
            y = find_root(y)
            if x != y:
                if rank[x] < rank[y]:
                    root[x] = root[y]
                    x,y = y,x
                if rank[x] == rank[y]:
                    rank[x] += 1
                root[y] = x       
                connected_num[x] += connected_num[y]

    """ initialize variables and set inputs
    
        
        
    
        
        
        
        
        
    
        
        
        
        
    
        
        
    """

    
    r = lambda: sys.stdin.readline().strip()
    r_int = lambda: int(r())
    R = lambda: list(map(int, r().split()))
    Rmap = lambda: map(int, r().split())
    Rfloat = lambda: list(map(float, r().split()))
    Rtuple = lambda: tuple(map(int, r().split()))

    """ how to treat input
    
    
    
    
    
    
    
    """

    if __name__ != '__main__':
        
        sys.stdin = open('sample.txt')

    
    

    N = int(r())
    A = R()
    cnt = Counter(A)
    if cnt[0] == N:
        print('Yes')
    elif cnt[0] == N//3 and len(cnt.keys()) == 2:
        print('Yes')
    elif len(cnt.keys()) == 3:
        flag = True
        tmp = 0
        for (key, val) in cnt.items():
            if val != N//3:
                flag = False
            tmp = tmp ^ key
        if flag and tmp == 0:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
    
    
    

    """memo: how to use defaultdict of list
    
    Dic = defaultdict(list)
    
    Dic[x].append(y)
    
    for k, v in Dic.items():
    """

if __name__ == '__main__':
    main()

Solution (Python):
import copy
import sys
import math

def main():
	n = int(input())
	a = list(map(int,input().split()))
	a.sort()
	xor = a[0] ^ a[1]
	for i in range(2,n):
		xor = xor ^ a[i]
	if(xor == 0):
		print('Yes')
	else:
		print('No')


def listtodict(a):
	b = {}
	for i in a:
		try:
			b[i] += 1
		except:
			b[i] = 1
	return b

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

main()

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
a1=A[0]
SumA=a1
SumA2=a1^a1
for i in range(1,N):
    a=A[i]
    SumA^=a
    SumA2^=a^a

if(SumA==SumA2):
    print('Yes')
else:
    print('No')

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 0
for a in A:
    ans = a ^ ans 
if ans == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
num_hats = list(map(int, input().split()))

X = 0

for num in num_hats:
    X ^= num

if X == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
a = [int(_) for _ in input().split()]
a = sorted(a)
s = set(a)

if len(s) == 1:
    if a[0] == 0:
        print("Yes")
    else:
        print("No")
elif len(s) == 2:
    if N % 3 != 0:
        print("No")
    else:
        if a.count(0) == N//3:
            print("Yes")
        else:
            print("No")
elif len(s) == 3:
    if a[0] == 0:
        print("No")
    else:
        L = []
        for i in s:
            L.append(i)
        
        if L[0] ^ L[1] == L[2]:
            p = a.count(L[0])
            q = a.count(L[1])
            r = a.count(L[2])
            if p == q and q == r:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
else:
    print("No")

Solution (Python):
from collections import Counter

N = int(input())
arr = list(map(int, input().split()))

arr.sort()
c = Counter(arr)

if N % 3 == 0:
    if len(c) == 3:
        x1, x2 = c.most_common()[0]
        y1, y2 = c.most_common()[1]
        z1, z2 = c.most_common()[2]
        if x2 == y2 == z2 and x1 ^ y1 == z1:
            print("Yes")
            exit()
    elif len(c) == 2:
        x1, x2 = c.most_common()[0]
        y1, y2 = c.most_common()[1]
        if x2 == 2 * y2 and y1 == 0:
            print("Yes")
            exit()

if N % 2 == 0:
    if len(c) == 2:
        x1, x2 = c.most_common()[0]
        y1, y2 = c.most_common()[1]
        if x2 == y2 and y1 == 0:
            print("Yes")
            exit()

if len(c) == 1:
    x1, x2 = c.most_common()[0]
    if x1 == 0:
        print("Yes")
        exit()

print("No")

Solution (Python):

"""
Created on Sun Jul 21 19:31:27 2019

@author: yama
"""

n = int(input())
l = list(map(int, input().split()))

x = 0
for i in l:
    x ^= i
    
if x == 0:
    print("Yes")
    
else:
    print("No")

Solution (Python):


import sys

n = int(input())
numbers = tuple(map(int, input().split()))
kinds = set(numbers)


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


if kinds == {0}:
    answer("Yes")

elif len(kinds) == 2:
    a, b = sorted(kinds)
    if a == 0:
        if numbers.count(a) * 3 == n:
            answer("Yes")
        else:
            answer("No")
    else:
        answer("No")

elif len(kinds) == 3:
    a, b, c = tuple(kinds)
    if (numbers.count(a) == numbers.count(b)) and (numbers.count(b) == numbers.count(c)):
        if a ^ b == c:  
            answer("Yes")
        else:
            answer("No")
    else:
        answer("No")
else:
    answer("No")

Solution (Python):
n=int(input())
li=list(map(int,input().split()))

ans=0
for i in range(len(li)):
  ans=ans^li[i]
if ans==0:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

if 0 in A:
  if len(set(A)) == 1:
    print("Yes")
    exit()
  elif len(set(A)) == 2:
    if A.count(0) *2 == (len(A)-A.count(0)):
      print("Yes")
      exit()
elif len(set(A)) == 3:
  temp =  list(set(A))
  if A.count(temp[0]) == A.count(temp[1]) == A.count(temp[2]):
    if (temp[0] ^ temp[1]) == temp[2]:
      print("Yes")
      exit()
print("No")

Solution (Python):



N = int(input())
l = [int(i) for i in input().split()]
l.sort()

lset = set(l)

if len(lset) == 1:
    if l[0] == 0:
        print("Yes")
    else:
        print("No")

elif N%3 == 0:
    if len(lset) == 2:
        k = list(lset)
        k.sort()
        if k[0]^k[1] == k[1] and l[int(N/3)] == k[1] and l[int(N/3 - 1)] == 0:
            print("Yes")
        else:
            print("No")
    
    elif len(lset) == 3:
        k = list(lset)
        k.sort()
        if k[0]^k[1] == k[2] or k[0]^k[2] == k[1]:
            c0 = 0
            c1 = 0
            for i in l:
                if i == k[0]:
                    c0 += 1
                elif i == k[1]:
                    c1 += 1
            if c0 == N/3 and c1 == N/3:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    else:
        print("No")
    
else:
    print("No")

Solution (Python):



N = int(input())
l = [int(i) for i in input().split()]
l.sort()

lset = set(l)

if N%3 == 0:
    if len(lset) == 1:
        if l[0] == 0:
            print("Yes")
        else:
            print("No")
            
    elif len(lset) == 2:
        k = list(lset)
        k.sort()
        if k[0]^k[1] == k[1] and l[int(N/3)] == k[1] and l[int(N/3 - 1)] == 0:
            print("Yes")
        else:
            print("No")
    
    elif len(lset) == 3:
        k = list(lset)
        k.sort()
        if k[0]^k[1]^k[2] == 0:
            c0 = 0
            c1 = 0
            for i in l:
                if i == k[0]:
                    c0 += 1
                elif i == k[1]:
                    c1 += 1
            if c0 == N/3 and c1 == N/3:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
            
    else:
        print("No")

else:
    if len(lset) == 1:
        if l[0] == 0:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Solution (Python):



N = int(input())
l = [int(i) for i in input().split()]
l.sort()

lset = set(l)

if N%3 == 0:
    if len(lset) == 1:
        if l[0] == 0:
            print("Yes")
        else:
            print("No")
            
    elif len(lset) == 2:
        k = list(lset)
        k.sort()
        if k[0]^k[1] == k[1] and l[int(N/3)] == k[1] and l[int(N/3 - 1)] == 0:
            print("Yes")
        else:
            print("No")
    
    elif len(lset) == 3:
        k = list(lset)
        k.sort()
        if k[0]^k[1] == k[2] or k[0]^k[2] == k[1]:
            c0 = 0
            c1 = 0
            for i in l:
                if i == k[0]:
                    c0 += 1
                elif i == k[1]:
                    c1 += 1
            if c0 == N/3 and c1 == N/3:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
            
    else:
        print("No")

else:
    if len(lset) == 1:
        if l[0] == 0:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Solution (Python):
N = int(input())
inputs = [int(i) for i in input().split()]

set_inputs = set(inputs)
if N % 3 == 0:
    list_inputs = list(set_inputs)
    if (len(set_inputs) == 3 
    and list_inputs[0] == (list_inputs[1] ^ list_inputs[2]) 
    and (inputs.count(list_inputs[0]) == inputs.count(list_inputs[1]) == inputs.count(list_inputs[2]))):
        print('Yes')
    elif len(set_inputs) == 2:
        list_inputs = list(set_inputs)
        if inputs.count(list_inputs[0]) > inputs.count(list_inputs[1]):
            more = list_inputs[0]
            less = list_inputs[1]
        else:
            more = list_inputs[1]
            less = list_inputs[0]
        if less == 0 and inputs.count(more) == inputs.count(less) * 2:
            print('Yes')
        else:
            print('No')
    elif len(set_inputs) == 1:
        if inputs[0] == 0:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    if set_inputs == set([0]):
        print('Yes')
    else:
        print('No')

Solution (Python):
n = int(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")

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

sum = 0
for i in range(N):
    sum ^= a[i]

print('Yes' if sum == 0 else 'No')

Solution (Python):
N = int(input())
a = [int(x) for x in input().split()]
all = 0
for i in a:
    all^=i
print('YNeos'[all!=0::2])

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
B = sorted(set(A))

if len(B) == 1 and B[0] == 0:
    print('Yes')
    exit()

if N % 3 == 0:
    if len(B) == 2 and A.count(0) == N // 3:
        print('Yes')
        exit()
    if len(B) == 3 and A.count(B[0]) == A.count(B[1]) == A.count(B[2]):
        if B[0] ^ B[1] ^ B[2] == 0:
            print('Yes')
            exit()

print('No')

Solution (Python):
from collections import Counter
N=int(input())
A=list(map(int,input().split()))
A=Counter(A).most_common()
A.sort(key=lambda x:x[0])
flag=1
if len(A)==3:
    for i in range(2):
        if A[i][1]==A[i+1][1]:
            continue
        else:
            flag=0
    for i in range(2):
        if i==0 :
            if A[i][0]==(A[i+1][0]^A[-1][0]):
                continue
            else:
                flag=0
        elif i==2:
            if A[i][0]==(A[i-1][0]^A[0][0]):
                continue
            else:
                flag=0
        else:
            if A[i][0]==(A[i-1][0]^A[i+1][0]):
                continue
            else:
                flag=0
    if flag==1:
        print("Yes")
    else:
        print("No")
else:
    if A[0][0]==0:
        if len(A)==1 or (len(A)==2 and A[0][1]==A[1][1]//2):
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Solution (Python):
N = int(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')

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
a.sort()
if N%3==0:
	k = N//3
	flg = 0
	x1, x2, x3 = -1, -1, -1
	if a[0]==a[k-1]:
		x1 = a[0]
		flg +=1
	if a[k]==a[2*k-1]:
		x2 = a[k]
		flg +=1
	if a[2*k]==a[3*k-1]:
		x3 = a[2*k]
		flg +=1
	if flg == 3:
		if (x1^x2)==x3 and (x2^x3)==x1 and (x3^x1)==x2:
			print("Yes")
		else:
			print("No")
	else:
		print("No")
else:
	if a[-1]==0:
		print("Yes")
	else:
		print("No")