import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Bits
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- getIntList
    let bitVec = VU.create $ do
            vec <- VUM.replicate 60 (0 :: Int)
            forM_ as $ \a -> do
                forM_ [0..59] $ \i -> do
                    when (testBit a i) $ VUM.modify vec succ i
            return vec
    print . fst $ VU.foldl' (\(s,i) k -> (modN ((powerMod 2 i) `mulMod` k `mulMod` (n-k) `plusMod` s), i+1)) (0,0) bitVec

moduloN :: Int
moduloN = 10 ^ 9 + 7

modN = flip mod moduloN

plusMod x y = modN $ x + y

minusMod x y | x < y = moduloN + x - y
             | otherwise = x - y

mulMod x y = modN $ x * y

powerMod x 0 = 1
powerMod x y
    | even y = mulMod t t
    | otherwise = mulMod x $ mulMod t t
    where
        t = powerMod x $ div y 2