import itertools
k=int(input())
l=[int(x) for x in input().rstrip().split()]
a=[]
for i,j in itertools.combinations(l,2):
    a.append([i,j])

A_1=0
A_2=0
ans=""
ANS=[]
for i in range(len(a)):
    A_1=format(a[i][0],'b')
    A_2=format(a[i][1],'b')
    if len(A_1)<len(A_2):
        A_1='0'*(len(A_2)-len(A_1))+A_1
    elif len(A_2)<len(A_1):
        A_2='0'*(len(A_1)-len(A_2))+A_2
 

    for j in range(len(A_1)):
        if A_1[j]==A_2[j]:
            ans=ans+'0'
        else:
            ans=ans+'1'
    ANS.append(ans)
    ans=''

SUM=0

for i in range(len(ANS)):
    SUM+=int(ANS[i],2)
SUM=SUM%(10**9+7)
print(SUM)