import numpy as np

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

mod = 10**9 + 7
ans = 0

for i in range(60):
    c = len(A[A&1==1])
    ans = (ans + c*(N-c)*pow(2,i,mod))%mod
    a = a >> 1

print(ans)
