N = int(input())
A = list(map(int,input().split()))
c0_1 = []
for i in range(60):
    c0_1.append([0,0])
for i in range(N):
    A[i] = list(str(bin(A[i]))[2:].zfill(60))
    for j in range(60):
        if A[i][j] == "0":
            c0_1[j][0] += 1
        else:
            c0_1[j][1] += 1

ans = 0
for i in range(60):
    ans += (c0_1[i][0] * c0_1[i][1]) * (2**(59-i))
    ans %= 10**9 + 7
print(ans)