n=int(input())
a=list(map(int,input().split()))
for i in range(n):
  a[i]=list(bin(a[i]))
  a[i]=a[i][2:]
  a[i].reverse()
  l=len(a[i])
  if l!=61:
    for j in range(61-l):
      a[i].append('0')
  a[i].reverse()
  a[i]=list(map(int,a[i]))
totl=0
p=10**9+7
for k in range(61):
  zero=0
  for i in range(n):
    if a[i][k]==0:
      zero+=1
  num=zero*(n-zero)
  for j in range(60-k):
    num=num*2
    if num>=p:
      num=num%p
  totl+=num
print(totl%p)
  