let m = 1_000_000_007
let n = read_int()
let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun i -> i))

let rec f i s =
  if i = 60 then s
  else
    let b = 1 lsl i in
    let rec g j z =
      if j = n then z
      else if a.(j) land b = 0 then g (j + 1) (z + 1)
      else g (j + 1) z in
    let z = g 0 0 in
    f (i + 1) ((s + b mod m * z mod m * (n - z) mod m) mod m)

let () = Printf.printf "%d\n" (f 0 0)
