n=int(input())
a=list(map(int,input().split()))
m=10**9+7
zeros=[0]*60
power2=[1]*60
for i in range(n):
  a[i]=format(a[i],'b')
  a[i]=a[i][::-1]
  for j in range(len(a[i])):
    if a[i][j]=='1':
      zeros[j]+=1
for i in range(1,60):
  power2[i]=(power2[i-1]*2)%m
ans=0
for i in range(60):
  ans=(ans+zeros[i]*(n-zeros[i])*power2[i])%m
print(ans)