import Data.Bits
import Data.Bool
import Data.List   

readInt = read :: String -> Integer

main = do
  n <- readInt <$> getLine
  ns <- map readInt . words <$> getLine
  --let n = 10
  --let ns = [3 ,14 ,159 ,2653 ,58979 ,323846 ,2643383 ,27950288 ,419716939 ,9375105820]  :: [Integer]
  let bits e = map (bool 0 1 . testBit e) [0 :: Int ..64]
  let totalbits1 = foldl1 (zipWith (+)) $  map bits ns
  let totalbits = map (\e -> e * (n - e)) totalbits1
  let pows = map (\b -> (bit b) `mod` (10^9 + 7)  :: Integer) [0 ..64]
  let ans =  sum $  zipWith (*) pows totalbits

  print $ ans `mod` (10^9 + 7)
  print  ns
