total = 0
N = int(input())
nums = list(map(int, input().split()))
for i in range(len(nums)):
    for j in range(i+1, len(nums)):
        total += nums[i] ^ nums[j]
        if total > 10**9:
            total = total % (10**9 + 7)
print(total)