N = int(input())
A = [int(x) for x in input().split()]

a_b = []
for i in A:
    this_b = []
    this_a = i
    for j in range(59,-1,-1):
        if this_a >= 2**j:
            this_b.append(1)
            this_a -= 2**j
        else:
            this_b.append(0)
    a_b.append(this_b)
    
#print(a_b)

count_a_b = []
for i in range(60):
    count_a_b.append(0)

    
for i in a_b:
    for j in range(len(i)):
        count_a_b[j] += i[j]
#print(count_a_b)

count = 0
for i in range(len(count_a_b)):
    count += (count_a_b[i] * (N-count_a_b[i])) *2**(59-i)
    
print(count%(10**9+7))