N=int(input()) 
A = [ bin(int(i))[2:].zfill(60) for i in input().split()] 

mod = 10**9+7
c = [0]*60
for i in A:
  for j in range(60):
    if i[j] == '1':
      c[-1-j] +=1     
ans = 0
for i in range(60):
  ans = (ans +(2**i)*(c[i]*(N-(c[i]))))%mod
  
print(ans)
