N = int(input())
tasu=[0 for i in range(60)]
A=list(map(int,input().split()))
for i in range(N):
  j=0
  a=bin(A[i])
  while a[-j-1]!="b":
    tasu[j]+=int(a[-j-1])
    j+=1
INF = 1000000007
ans=sum(tasu[i]*(N-tasu[i])<<i for i in range(60))%INF
print(ans)
