n=int(input())
l=list(map(int,input().split()))

k=len(bin(max(l)))-2

for i in range(n):
    l[i]=bin(l[i])[2:]

ll=[[0,0] for i in range(k)]
for i in range(n):
    for j in range(k):
        try:
            if l[i][-1-j]=="1":
                ll[j][1]+=1
            if l[i][-1-j]=="0":
                ll[j][0]+=1
        except IndexError:
            ll[j][0]+=1

m=0
for i in range(k):
    m+=ll[i][0]*ll[i][1]*(2**i)
print(m%(10**9+7))
