;; D - Xor Sum 4

(defparameter *modulus* (+ (expt 10 9) 7))
(defparameter *max-bits* 60)

(defun main ()
  (print (solve (read)))
  (fresh-line))

(defun solve (N)
  ; 各桁を集約
  (reduce #'(lambda (l h) (mod (+ l (ash h 1)) *modulus*))
    ; 2進各桁のXORの総和 (= 1の個数 * 0の個数)
    (map 'vector #'(lambda (m) (* m (- N m)))
      ; 各数を2進数に変換したときの各桁の1の個数を求める
      (loop with vec = (make-array *max-bits* :initial-element 0)
            repeat N do (add-bits-to-vector (read) vec)
            finally (return vec)))
    :from-end t))

(defun add-bits-to-vector (n vec)
  "配列vecに整数nの2進各桁を加える"
  (loop for i from 0 below *max-bits*
        for m = n then (ash m -1) do (incf (aref vec i) (mod m 2))))

(main)
