n=int(input())
a=list(map(int,input().split()))
su=0
#a=[]
#for i in range(1,n):
#    c=int(input())
#    a.append(c) 
for i in range (n-1):
    for j in range(i+1,n):
        su+=a[i]^a[j]
print(su%(1000000000+7))