import sys
input = sys.stdin.readline

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

mod = 10**9 + 7

res = 0

for i in range(60):
    count = 0
    for j in range(N):
        if ((A[j] >> i) & 1):
            count += 1
    res += (N - count) * count * 2 ** i 
    res %= mod

print(res)
