import strutils,sequtils
import algorithm,sets,lists,critbits,sequtils,intsets,strutils,tables,math,heapqueue,future

const DIVISOR = 10^9 + 7

let read = iterator: string {.closure.} =
  while true:
    for s in stdin.readLine.split:
      yield s

let
  N = read().parseInt
  ai = stdin.readLine.split.map parseBiggestInt
  d_max = 60

var counter = newSeqWith(60, newSeq[int](2))

for a in ai:
  for d in 0..<d_max:
    let f = (a shr d) mod 2
    counter[d][f] += 1

var ans = 0
for d in 0..<d_max:
  var addend = (2^d * counter[d][0]) mod DIVISOR
  addend = (addend * counter[d][1]) mod DIVISOR
  ans = (ans + addend) mod DIVISOR

echo ans
