import Data.Bits
import Data.Bool
import Data.List   
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as B8
import Data.Maybe

readInteger = fst . fromJust . B8.readInteger

main = do
  n <- readInteger <$> B.getLine
  ns <- map readInteger . B8.words <$> B.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)
