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

if __name__ == '__main__':
    main()
