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

mod = 10 ** 9 + 7

res = 0
for d in range(60):
    one = sum(x & 1 for x in arr)
    res = (res + one * (n - one) * (1 << d)) % mod
    arr = [x >> 1 for x in arr]

print(res)
