#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.append(A[0])
    ret = 'Yes'
    for i in range(1, N):
        if A[i-1]^A[i+1] != A[i]:
            ret = 'No'
    print(ret)


if __name__ == '__main__':
    main()