N = int(input())
A_i = list(map(int, input().split()))

total = 0

for i in range(0, N):
    for j in range(i + 1, N):
        total += int((A_i[i] ^ A_i[j]) % (1.0e+9 + 7))


total %= int(1.0e+9 + 7)

print(total)
