(defun splitat (c line)
  (labels ((rec (line acc)
				(let ((pos (position-if (lambda(cc) (char= c cc)) line)))
				  (if pos
					  (rec (subseq line (1+ pos)) (cons (subseq line 0 pos) acc))
					(nreverse (cons line acc))))))
	(rec line nil)))

(defun g(lst0)
  (let* ((lst (cons (car lst0) (reverse lst0)))
		 (len (length lst))
		 (vec (make-array len :initial-contents lst)))
	(labels ((rec (i)
				  (if (= i (- len 2))
					t
					(if (= (aref vec (1+ i)) (logxor (aref vec i) (aref vec (+ i 2))))
					  (rec (1+ i))
					  nil))))
	  (rec 0))))
(defun f ()
  (let* ((n (parse-integer(read-line nil nil)))
		 (lst (mapcar #'parse-integer (splitat #\space (read-line nil nil)))))
	  (format t "~A~%" (if (g lst) "Yes" "No"))))
(compile 'g)
(f)
;(format t "~A~%" (g '(1 2 3)))
;(format t "~A~%" (g '(1 2 4 8)))