import sys
input = sys.stdin.readline
def judge(a, b, c):
    return a ^ b ^ c == 0
def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = "Yes"
    for i in range(N):
        if i == 0:
            a, b, c = A[-1], A[0], A[1]
        elif i == N-1:
            a, b, c = A[i-1], A[i], A[0]
        else:
            a, b, c = A[i-1], A[i], A[i+1]
        if not judge(a, b, c):
            ans = "No"
            break
    print(ans)
if __name__ == "__main__":
    main()