import itertools
N = int(input())
w = [int(x) for x in input().split()]
x = [balls for balls in itertools.combinations(w, 2)]
count = [i[0]^i[1] for i in x]
result = sum(count) % (10**9+7)
print(result)