import math
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
if max(a)==0:
  print(0)
  exit()
m=math.floor(math.log2(max(a)))+1
ans=0
for i in range(m):
  cnt0=0
  cnt1=0
  for j in range(n):
    if a[j]>>i&1:
      cnt1+=1
    else:
      cnt0+=1
  ans+=(2**i)*(cnt1*cnt0)
  ans%=mod
print(ans)