n=int(input())
l=list(map(int,input().split()))
d_max=max(l)
dp=[[-1 for i in range(d_max+1)] for j in range(d_max+1)]
ans=0

for i in range(n):
    for j in range(i,n):
        a=0
        if i == j:
            continue
        if dp[l[i]][l[j]] == -1:
            a=l[i]^l[j]
            dp[l[i]][l[j]]=a
        else:
            a=dp[l[i]][l[j]]
        ans+=a

print(ans%(10**9+7))