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

ans = True
if N % 3 != 0:
    for i in range(N):
        if a[i] != 0:   
            ans = False
else:
    first = a[0]
    i_second = -1
    for i in range(1, N):
        if a[i] != first:
            second = a[i]
            i_second = i
            break
        
    if i_second == -1:
        for i in range(N):
            if a[i] != 0:
                ans = False
    else:
        for i in range(i_second+1, N):
            if (a[i] != first) and (a[i] != second):
                third = a[i]
                break
        if (first ^ second != third) or (second ^ third != first) or (third ^ first != second):
            ans = False
        else:
            cnt_first = 0
            cnt_second = 0
            cnt_third = 0
            for i in range(N):
                if a[i] == first:
                    cnt_first += 1
                elif a[i] == second:
                    cnt_second += 1
                elif a[i] == third:
                    cnt_third += 1
            if (cnt_first != N/3) or (cnt_second != N/3) or (cnt_third != N/3):
                ans = False

if ans is True:
    print('Yes')
else:
    print('No')
