n=int(input())
a_lis=list(map(int,input().split()))
ans=0
for i in range(1,n):
    for j in range(i+1,n+1):
        a1=a_lis[i-1]
        a2=a_lis[j-1]
        c=a1^a2
        ans+=c
print(ans%1000000007)