N = int(input())
lis = list(map(int,input().split()))
maxi = max(lis)
bi = len(format(maxi,"b"))
zero = [0]*bi
one = [0]*bi
for i in range(bi):
    for j in range(N):
        tmp = "0"*(bi-len(format(lis[j],"b"))) + format(lis[j],"b")
        
        if tmp[bi-1-i] == "1":
            one[bi-1-i] += 1
        else:
            zero[bi-1-i] += 1

result = 0

for i in range(bi):
    result += (zero[bi-1-i]*one[bi-1-i]*(2**(i)))%(10**9+7)
print(result)
