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 + (an.(i) lxor an.(j))) mod m
    done
  done;
  Printf.printf "%d\n" !sum