n = int(input())
ar = list(map(int, input().split()))
res = 0
mod = 10 ** 9 + 7
for i in range(60):
    zero = 0
    one = 0
    for j in range(len(ar)):
        if ar[j] % 2 == 0:
            zero += 1
        else:
            one += 1
        ar[j] = ar[j] // 2
    curr = (zero * one * (1 << i)) % mod
    res = (res + curr) % mod
print(res)
