if __name__ == '__main__':
    n, = map(int, input())
    a = list(map(int, input().split()))
    flag = True
    for i in range(0, n):
        b = i - 1
        c = i + 1
        if b < 0:
            b = n - 1
        if c >= n:
            c = 0
        if a[b] ^ a[c] != a[i]:
            flag = False
            break
    if flag:
        print("Yes")
    else:
        print("No")
