import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(input())
a = np.array(read().split(), np.int64)

mod = 10 ** 9 + 7
ans = 0
b = [0] * len(a)

for i in range(61):
    for j in range(n):
        b[j] = (a[j] >> i) & 1
    x = len(b) - sum(b)
    y = n - x
    z = x * y
    z *= 2 ** i
    z %= mod
    ans += z
ans %= mod

print(ans)
