import numpy as np
N = int(input())
A = np.array([int(_) for _ in input().split()], dtype=np.int64)
mod = 10**9 + 7
ans = 0
for b in range(60):
    M = np.sum((A >> b) & 1)
    ans += 2**b * M * (N - M)
    ans %= mod
print(ans)
