import numpy as np

mod = 10 ** 9 + 7
n = int(input())
a = np.array(list(map(int, input().split())), np.int64)

ans = 0
for i in range(60):
    b = (a >> i) & 1
    cnt = np.sum(b[b == 1])
    ans = (ans + (cnt * (n - cnt)) * (2 ** i)) % mod
print(ans)