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

for i in range(60):
  n1,n0 = 0,0
  for a in A:
    if a>>i & 1: n1+=1
    else: n0+=1
  ans += (2**i)*n1*n0 % mod
ans %= mod
print(ans)