N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7 

lb0 = [0]*60
lb1 = [0]*60
for i in range(N):
  bs = format(A[i],"060b")
  for j in range(60):
    if bs[j] == "0":
      lb0[j] += 1
    if bs[j] == "1":
      lb1[j] += 1  
###
ans = 0
for i in range(60):
  ans += ((lb0[i]*lb1[i] %mod)*(2**(59-i) %mod)) %mod
  ans %= mod
print(ans)  