n=int(input())
l=list(map(int,input().split()))
dic=dict(zip(range(n),l))
ans=0
for i in range(n):
    for j in range(i,n):
        if i == j:
            continue
        ans+=dic[i]^dic[j]
print(ans%(10**9+7))