n = int(input())
z = 7 + (10 ** 9)
nums = list(map(int, input().split()))
ans = 0
for x in range(len(nums)):
    for y in range(x, len(nums)):
        u = nums[x] ^ nums[y]
        ans = ans + u
print(ans % z)
