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

def main():
    if a[0] != a[-1] ^ a[1]:
        print("No")
        return
    for i in range(1, N - 1):
        if a[i] != a[i + 1] ^ a[i - 1]:
            print("No")
            return
    if a[N - 1] != a[0] ^ a[N - 2]:
        print("No")
        return
    print("Yes")

main()