# coding: utf-8
from itertools import combinations

line = int(input().rstrip())
x = input().rstrip().split(' ')
xors = combinations(x, 2)
print(sum(int(xor[0]) ^ int(xor[1]) for xor in xors) % (10 ** 9 + 7))
