import itertools
import numpy

S = int(input())
a = [int(i) for i in input().split()]

xor = 0
patern = list(itertools.combinations(a, 2))
for p in patern:
    xor += p[0] ^ p[1]
if xor >= 10 ** 9:
    print(np.mod(xor, (10 ** 9 + 7)))
else:
    print(xor)