import numpy as np
import itertools as it

N=int(input())
a_l=np.array([int(i) for i in input().split()])

def xor(i,j):
    l=max(len(str(format(i,'b'))),len(str(format(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)
    return ans

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