# coding: utf-8
# Here your code !

#def change_bin(data):
#    return format(data,"b").zfill(64)
    
N = int(input())
A = [int(N) for N in input().split()]
#A_bin = list(map(change_bin, A))
max_size = len(format(max(A),"b"))
A_bin = list(map(lambda x: format(x,"b").zfill(max_size), A))


result = 0
for i in range(max_size):
    zero = 0
    one = 0
    for j in A_bin:
        if j[i] == "0":
            zero += 1
        else:
            one += 1
    result += 2**(max_size-1-i) * zero * one

print(result%1000000007)