n=int(input())
l1=[0]*61
l=list(map(int,input().split()))
for j in range(n):
  s=list(str(bin(l[j])))
  for i in range(61):
    if i==len(s)-2:
      break
    if s[-i-1]=='1':
      l1[i]+=1
c=0
for i in range(61):
  c+=pow(2,i,10**9+7)*(n-l1[i])*l1[i]%(10**9+7)
print(c%(10**9+7))