n=int(input())
A=list(map(int,input().split()))
mod=10**9+7
ans=0
from itertools import combinations
base = list(combinations(A,2))
for i in range(len(base)):
  ans+=base[i][0]^base[i][1]
print(ans%mod)
