import future, strutils, parseutils, sequtils, math


const
  M = 10^9 + 7
let
  N = stdin.readLine().parseInt()
  A = stdin.readLine().split().map(parseInt)
var
  bit_sum: array[60, int]
  result = 0

for i in 0..<60:
    let target = (1 shl i)
    for a in A:
        if (target and a) != 0:
            bit_sum[i].inc()
    result += ((bit_sum[i] * (N - bit_sum[i])) shl i) mod M
    result = result mod M

echo result