program main
implicit none
integer :: n, i, j, k
integer , allocatable :: a(:)

read(*,*) n
allocate( a(n) )
read(*,*) a

i = xor( a(2), a(n) )
k = a(1)
do j = 2, n-1
   i = i + xor(a(j-1),a(j+1))
   k = k +a(j)
end do
i = i + xor(a(1),a(n-1))
k = k + a(n)
if ( i == k ) then
   write(*,*) 'Yes'
else
   write(*,*) 'No'
end if

end program main
