import itertools as it
N=input()
a_l=[int(i) for i in input().split()]

def xor(i,j):
    l=len(str(format(max(i,j),'b')))
    i2=str(format(i,'b').zfill(l))
    j2=str(format(j,'b').zfill(l))
    ans=0
    for k in range(l):
        if i2[k]!=j2[k]:
            ans+=2**(l-k-1)
    yield ans

sum1=0
for (i,j) in it.combinations(a_l, 2):
    for k in xor(i,j):
        sum1+=k
print(sum1%(7+10**9))