N = int(input())
A = list(map(int,input().split()))
zero_count = 0
one_count = 0
xor_bit = 0
xor = 0

A_bin = list(map(lambda x: str(format(x,"060b")),A))

for i in range(60):
    zero_count = 0
    one_count = 0

    for j in range(N):
        if A_bin[j][i] == "0":
            zero_count += 1
        else:
            one_count += 1
    
    xor_bit = zero_count * one_count * (2**(59-i))
    xor += xor_bit

print(xor % (10**9 + 7))
