n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d=[[0]*2 for _ in range(60)]

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        d[j][int(lis[i][-j-1])]+=1

ans=0
for i in range(60):
    ans+=(d[i][0]*d[i][1]*2**i)%(10**9+7)
print(ans%(10**9+7))