mod = 10**9 + 7
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(61):
    cnt_0 = 0
    cnt_1 = 0
    for j in range(N):
        if (A[j] >> i & 1):
            cnt_1 += 1
        else:
            cnt_0 += 1
    ans += (cnt_1 * cnt_0 * (2**i)) % mod
print(ans % mod)