N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7

for i in range(N): A[i] = format(A[i], "#062b")

#print(*A,sep="\n")
nijou = 1 #二乗計算を高速化するため
xorsum = 0
for i in range(60):
    count0 = 0
    count1 = 0
    for j in range(N):
        if A[j][-(i+1)] == "0":
            count0 += 1
        else:
            count1 += 1
    xorsum += ((count0*count1)%mod)*nijou%mod
    nijou *= 2

print(xorsum%mod)

