p = int(1e9+7)

N = int(input())
A = list(map(int, input().split()))
A = list(map(lambda x: format(x, '0b').zfill(60), A))
res = 0

for i in range(60):
    one = 0
    for a in A:
        one += int(a[-(i+1)])
    res += one*(N-one)*2**i
    res %= p

print(res)