from itertools import combinations

mod = 10**9 + 7

n = int(input())
a = [int(x) for x in input().split()]

# xor = [x^y for x, y in combinations(a, 2)]
# print(sum(xor) % mod)

res = 0
for x, y in combinations(a, 2):
    res += (x^y)
    res %= mod

print(res)