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

let () =
  let ans = ref 0 in
  for i = 0 to 59 do
    let b = 1 lsl i in
    let z = Array.fold_left (fun z a -> if a land b = 0 then z + 1 else z) 0 a in
    ans := (!ans + b mod m * z mod m * (n - z) mod m) mod m
  done;
  Printf.printf "%d\n" !ans
