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