_ = input()
A = list(map(int, input().strip().split()))
n = len(A)
res = 0
for i in range(n-1):
    for j in range(i+1, n):
        res += (A[i]^A[j])
        print(A[i], A[j], res)
res = res % (int(1e9) + 7)
print(res)
