N = int(input())
A_list = input().split()
int_list = []
append = int_list.append
for v in A_list:
    append(int(v))

sum = 0

for m in range(N-1):
    for n in range(m+1,N):
        sum += (int_list[m]^int_list[n])

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