def xor(a, b):
    xor = a ^ b
    return xor


n = int(input())
a = list(map(int, input().split()))

count = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        count += xor(a[i], a[j])

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