N = int(input())
from collections import defaultdict
d = defaultdict(int)
for i in map(int,input().split()):
  for idx,j in enumerate(reversed('{:b}'.format(i))):
    if j == "1":
      d[idx]+=1

m = max( set(d.keys()) )

A=1
res=0
for i in range(m+1):
  res += (A* (N-d[i])*d[i])%(1e9+7) 
  A = int((A*2) %(1e9+7))
  
print(int(res%(1e9+7)))