import itertools
N = int(input())
A = [int(i) for i in input().split()]
A = tuple(A)
count = 0
for z in list(itertools.combinations(A, 2)):
    a, b = z
    count += a^b
print(count % (10**9+7))
print()