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