N = int(input())
A = [format(int(a), "b") for a in input().split()]

for n in range(N):
  my_nm = int(A[n])
  if n == N-1:
    total_neighbor_nm = int(A[N-2]) + int(A[0])
  else:
    total_neighbor_nm = int(A[n-1]) + int(A[n+1])
  TNN = [tnn for tnn in str(total_neighbor_nm)]
  for i in range(len(TNN)):
    if int(TNN[i]) % 2 == 0:
      TNN[i] = "0"
    else:
      TNN[i] = "1"
  if my_nm == int("".join(TNN)):
    continue
  else:
    print("No")
    break
else:
  print("Yes")