from itertools import combinations
N = input()
A = list(map(int, input().split()))

# ans = 0
# for v in combinations(A, 2):
#     ans += v[0] ^ v[1]
ans =sum([v[0]^v[1] for  v in combinations(A, 2)])
print(int(ans % (10e8+7)))