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)))
    left = [int(A[i])]
    right = list((map(int, A[i+1:])))
    print(left)
    print(right)
    xor +=sum(np.bitwise_xor(left, right))
    
print(xor%(10**9+7))
