import sys
import numpy as np
 
n = int(input())
lst = np.array([int(i) for i in sys.stdin.readline().split()])

mod = 10 ** 9 + 7
c = []

for i in range(60):
    c1 = sum(lst & 1)
    c.append(c1 * (n - c1))
    lst >>= 1
print(sum([v * 2 ** i for i, v in enumerate(c)]) % mod)