n = int(input())
A = list(map(int,input().split()))
l = len(A)
sum = 0
for i in range(l-1):
    for j in range(i+1,l):
        if A[i] != A[j]:
            sum += (A[i] ^ A[j])
print(sum%(10**9 +7) if sum >= 10**9+7 else sum)