import itertools

divisor = (10 ** 9) + 7

N = int(input())
numbers = [int(i) for i in input().split()]
combinations = list(itertools.combinations(numbers, 2))

xors = [c[0] ^ c[1] for c in combinations]

output = sum(xors) % divisor
print(output)
