let () =
    let main () =
        let n = Scanf.scanf "%d" (fun n -> n) in
        let m = 1000000000 + 7 in
        let ( +@) a b = (a + b) mod m in
        let ( *@) a b = ((a mod m) * (b mod m)) mod m in
        let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
        let rec loop i acc =
            if i = 60 then acc else
                let d0, d1 = Array.fold_left (fun (acc1, acc2) v ->
                    if v land (1 lsl i) = 0 then acc1 + 1, acc2 else acc1, acc2 + 1) (0, 0) a
                in
                loop (i + 1) (acc +@ d0 *@ d1 *@ (1 lsl i))
        in
        Printf.printf "%d\n" (loop 0 0)
    in
    main ()