N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7
ans = 0
for k in range(61):
    one = 0
    zero = 0
    for i in range(N):
        if A[i]%2==0:zero+=1
        else:one+=1
        A[i]//=2
    ans += (one*zero)*(2**k)
print(ans%MOD)