import itertools
mod=1000000007

N=int(input())
As=list(map(int,input().split()))

List=list(itertools.combinations(As,2)) #2つ選ぶ列挙

Ans=0
for i in range(len(List)):
        Ans+=(List[i][0] ^ List[i][1])%mod

print(Ans%mod)
