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

total = 0
for i in range(N-1):
    for j in range(i+1, N):
        total = total + (A[i] ^ A[j])

threshold = 10**9+7
if total < threshold:
    print(total)
else:
    print(total%threshold)