def resolve():
    '''
    code here
    '''
    N = int(input())
    As = [int(item) for item in input().split()] 

    is_true = True
    for i in range(N):
        if As[i -1] ^ As[(i+1)%N] ^ As[i] != 0:
            is_true = False
        

    print('Yes') if is_true else print('No')
        



if __name__ == "__main__":
    resolve()
