n = int(input())
a_list = list(map(int,input().split()))

num_max = len(bin(max(a_list)))-2
bin_list = [['0' for _ in range(num_max-len(bin(a))+2)] + list(bin(a))[2:] for a in a_list]

flag = True
score = 0
count = 0

for i in range(num_max):
    array = []
    for l in bin_list:
        if len(l)-1 >= count:
            array.append(l[count])
    count_0 = array.count('0')
    count_1 = array.count('1')
    score += count_0*count_1*(2**(num_max-i-1))
    score = score % 1000000007
    count += 1

print(score)