import future, strutils, parseutils, sequtils, math


let
  N = stdin.readLine.parseInt
  A = stdin.readLine().split().map(parseInt)

var
  on: int
  result = 0
for i in 0..<60:
    on = sum(lc[((1 shl i) and a) | (a <- A) , int]) shr i
    result += (on * (N - on)) shl i
    result = result mod ((10^9) + 7)

echo result
