def resolve():
    N = int(input())
    a = [int(i) for i in input().split()]
    count = 0
    if (a[0] != a[N - 1] ^ a[1]):
        count += 1
    if (a[N - 1] != a[N - 2] ^ a[0]):
        count += 1
    for i in range(1, N - 1):
        if (a[i] != a[i - 1] ^ a[i + 1]):
            count += 1
    if (count == 0):
        print("Yes")
    else:
        print("No")
resolve()