n = int(input())
a = list(map(int,input().split()))
os = [0 for _ in range(60)]
for i in range(n):
  bi = bin(a[i])[2:]
  for j in range(len(bi)):
    if bi[-j-1] == "1":
      os[j] += 1
mod = 10**9+7
s = 0
k = 1
for i in range(60):
  x = (n-os[i])*os[i]
  s = (s+x*k)%mod
  k = (2*k)%mod
print(s)
  
      
    
