Buggy python submission (verdict: Runtime Error):
N = int(input())
d = list(map(int,input().split()))
d_unique = list(set(d))

if len(d_unique) == 1:
    if d_unique[0] == 0:
        print('Yes')
    else:
        print('No')

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

    else :
        if len(d_unique) == 2 :
            i1 = d_unique[0]
            i2 = d_unique[1]
            len_i1 = d.count(i1)
            len_i2 = d.count(i2)
            if len_i1 ==  N/3 and i1 & i2 & i2 = 0:
                print('Yes')
            elif len_i2 ==  N/3 and i1 & i1 & i2 != 0:
                print('Yes')                
            else :
                print('No')

        elif len(d_unique) == 3 :
            i1 = d_unique[0]
            i2 = d_unique[1]
            i3 = d_unique[2]
            len_i1 = d.count(i1)
            len_i2 = d.count(i2)
            len_i3 = d.count(i3)
            if i1 & i2 & i3 != 0:
                print('No')     
            else:
                if len_i1 ==  N/3 and len_i2 == N/3 :
                    print('Yes')
                else :
                    print('No')    



Fixed submission:
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)

Buggy python submission (verdict: Runtime Error):
N = int(input())
d = list(map(int,input().split()))
d_unique = list(set(d))

if len(d_unique) == 1:
    if d_unique[0] == 0:
        print('Yes')
    else:
        print('No')

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

    else :
        if len(d_unique) == 2 :
            i1 = d_unique[0]
            i2 = d_unique[1]
            len_i1 = d.count(i1)
            len_i2 = d.count(i2)
            if len_i1 ==  N/3 and i1 & i2 & i2 = 0: :
                print('Yes')
            elif len_i2 ==  N/3 and i1 & i1 & i2 != 0: :
                print('Yes')                
            else :
                print('No')

        elif len(d_unique) == 3 :
            i1 = d_unique[0]
            i2 = d_unique[1]
            i3 = d_unique[2]
            len_i1 = d.count(i1)
            len_i2 = d.count(i2)
            len_i3 = d.count(i3)
            if i1 & i2 & i3 != 0:
                print('No')     
            else:
                if len_i1 ==  N/3 and len_i2 == N/3 :
                    print('Yes')
                else :
                    print('No')    



Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = list(map(int,input().split()))
d = l.copy()

count = 0
i = 0
while len(d) != 0:
    if count == 0:
        a = 0
        count += 1
        for j in range(N-count):
            target = d[i] ^ d[j]
            if target in d :
                a += 1
                i = j
            if a == 1:
                break
        if a >= 1 :
            i2 = target
            mae =d[i]
            d.pop(i)
        else:
            print('No')
            break
    
    elif 1 <= count <= N-3:
        a = 0
        count += 1
        for j in range(N-count):
            if target == mae ^ d[j] :
                a += 1
                i = j
            if a == 1:
                break
        if a >= 1 :
            mae =d[i]
            d.pop(i)
        else:
            print('No')
            break
    
    elif count == N-2:
        a = 0
        count += 1
        if mae == target ^ l[0] :
            pass
        else:
            print('No')
            break    

    else:
        if l[0] == i2  ^   mae :
            print('Yes')
            break
        else:
            print('No')
            break 

Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = list(map(int,input().split()))
d = l.copy()

count = 0
i = 0
while len(d) != 0:
    if count == 0:
        a = 0
        count += 1
        for j in range(N-count):
            target = d[i] ^ d[j]
            if target in d :
                a += 1
                i = j
            if a == 1:
                break
        if a >= 1 :
            i2 = target
            mae =d[i]
            d.pop(i)
        else:
            print('No')
            break
    
    elif 1 <= count <= N-3:
        a = 0
        count += 1
        for j in range(N-count):
            if target == mae ^ d[j] :
                a += 1
                i = j
            if a == 1:
                break
        if a >= 1 :
            mae =d[i]
            d.pop(i)
        else:
            print('No')
            break
    
    elif count == N-2:
        a = 0
        count += 1
        if mae == target ^ l[0] :
            pass
        else:
            print('No')
            break    

    else:
        if l[0] == i2  ^   mae :
            print('Yes')
            break
        else:
            print('No')
            break 

Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = list(map(int,input().split()))
d = l.copy()

count = 0
i = 0
while len(d) != 0:
    if count == 0:
        a = 0
        count += 1
        for j in range(N-count):
            target = d[i] ^ d[j]
            if target in d :
                a += 1
                i = j
        if a >= 1 :
            i2 = target
            mae =d[i]
            d.pop(i)
        else:
            print('No')
            break
    
    elif 1 <= count <= N-3:
        a = 0
        count += 1
        for j in range(N-count):
            if target == mae ^ d[j] :
                a += 1
                i = j
        if a >= 1 :
            mae =d[i]
            d.pop(i)
        else:
            print('No')
            break
    
    elif count == N-2:
        a = 0
        count += 1
        if mae == target ^ l[0] :
            pass
        else:
            print('No')
            break    

    else:
        if l[0] == i2  ^   mae :
            print('Yes')
            break
        else:
            print('No')
            break 


Fixed submission:
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)