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

def plus(i):
    global sum_xor
    sum_xor += i

for m in range(N-1):
    for v in A_list[m+1:]:
        plus(A_list[m] ^ v)

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