N = int(input())

A = list(map(int, input().split()))

bin_list = [0 for i in range(60)]

for i in range(N):
    for j in range(len(bin(A[i]))-2):
        if bin(A[i])[-(j+1)] == '1':
            bin_list[j] += 1

div = 1000000007

ans = 0

for i in range(60):
    ans += (bin_list[i] * (N-bin_list[i]) % div) * ((1 << i) % div) % div
    ans = ans % div

print(ans)
