import numpy as np
n=int(input())
arr=np.array([int(i) for i in input().split()])
def sumXOR(arr, n):
    MOD=int((1e+9)+7)
    summ = 0
    for i in range(0, 61):
        zc = 0
        oc = 0
        idsum = 0
        newarr=arr % 2
        oc = np.sum(newarr)
        zc = n-oc
        arr = arr//2
        idsum = oc * zc * ((1 << i)%MOD)
        summ = (summ + idsum)%MOD
    return summ

ans = sumXOR(arr, n)
print (ans) 