(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 f(lst)
  (labels ((rec (lst a acc)
                (if (null lst)
                   acc
                   (rec (cdr lst) a (+ acc (logxor a (car lst))))))
           (rec0 (lst acc)
                 (if (null (cdr lst))
                   acc
                   (rec0 (cdr lst) (rec (cdr lst) (car lst) acc)))))
    (rec0 lst 0)))
(let* ((line0 (read-line nil nil))
       (line1 (mapcar #'parse-integer (splitat #\space (read-line nil nil)))))
  (format t "~A~%" (mod (f line1) (+ 7 (expt 10 9)))))
