import math

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

A = int(math.log2(max(a))) + 1

abit = [bin(an)[2:].zfill(A) for an in a]

amari = 0
for i in range(A):
    zero_count = 0
    for j in range(n):
        if abit[j][A - 1 - i] == "0":
            zero_count += 1
    amari = (amari + (zero_count * (n - zero_count) * (2 ** i)) % (10 ** 9 + 7)) % (10 ** 9 + 7) 

print(amari)