n = int(input())
aa = list(map(int,input().split()))

d = [0]*60
for ai in aa:
  for e,i in enumerate(bin(ai)[:1:-1]):
    d[e]+=int(i) 

ans = 0
for i in range(len(d)):
  if d[i]==0 or d[i]==n:
    pass
  else:     
    #print(d[i]*(n-d[i])* 2**(i))    
    ans += d[i]*(n-d[i])* 2**(i)
    ans %= (10**9+7)
    
print(ans)    