N = int(input())
A = list(map(int, input().split()))

Cn, ans = N * (N-1) // 2, 0

for i in range(60):
    count = 0
    for j in range(N):
        count += A[j] % 2
        A[j] //= 2
    if count == 0:
        continue
    ans += (Cn - (count*(count-1)//2 + (N-count)*(N-count-1)//2)) * (2**i)
print(ans % (10**9 + 7)) 