import sys
import numpy as np
N = int(input())
A = input().split()

xor = 0

for i in range(N-1):
    left = set(map(int, A[i] * (N-i)))
    right = set(map(int, A[i:]))
    xor += (sum(list(left.symmetric_difference(right))))

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


# N = int(input())
# A = input().split()

# xor = 0
# for i in range(N-1):
#     for j in range(i+1, N):
#         xor += int(A[i]) ^ int(A[j])
# print(xor%(10**9+7))