import numpy as np

n=int(input())

a=[]

a= list(map(int,input().split()))

ans=0
for i in range(n-1):
    for k in range(i,n):
        tmp=a[i]^a[k]
        #print(tmp)
        ans=(ans+tmp)%1000000007

print(ans)
    
