def resolve():
    '''
    code here
    '''
    N = int(input())
    As = [int(item) for item in input().split()] 
    temp_set = set(As)
    is_true = True
    if len(temp_set) == 1:
        if As[0] != 0:
            is_true = False
    elif len(temp_set) == 2:
        x_num = As.count(max(As))
        zero_num = As.count(0)
        if x_num != 2*zero_num:
            is_true = False
    else:
        for i in range(N):
            if As[i -1] ^ As[(i+1)%N] ^ As[i] != 0:
                is_true = False
                break

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



if __name__ == "__main__":
    resolve()
