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 += (A_i[i] ^ A_i[j]) % 1000000007


total %= 1000000007

print(total)
