import itertools

ind = int(input())
nums = [int(x) for x in input().split()]
MOD = 1000000007
ans = 0
for v in itertools.combinations(nums, 2):
    # XOR は四則演算よりも優先度が低い…….
    ans = (ans + (v[0] ^ v[1])) % MOD

print(ans)
