N = int(input())
A_list = list(map(int, input().split()))
sum = 0

for i in range(N-1):
    for j in range(i+1, N):
        print("i= " + str(A_list[i]) + " j= " + str(A_list[j]))
        print(A_list[i] ^ A_list[j])
        sum += A_list[i] ^ A_list[j]

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