let xor x y =
  let ret, b =  ref 0, ref 1 in
  while !b <= x || !b <= y do
    if !b land x != !b land y then ret := !ret + !b;
    b := !b lsl 1
  done;
  !ret

let () =
  let n = Scanf.scanf "%d\n" (fun d -> d) in
  let an = Array.init n @@
    fun x -> Scanf.scanf (if x==n-1 then "%d\n" else "%d ") @@ fun c -> c
  in
  let m = int_of_float(10.0 ** 9.) + 7 in
  let sum = ref 0 in
  for i = 0 to n-1 do
    for j = i to n-1 do
      sum := (!sum + xor an.(i) an.(j)) mod m
    done
  done;
  Printf.printf "%d\n" !sum