n = int(input())
nums = input().split()
sum = 0
for i in range(len(nums)):
    for j in range(i + 1,len(nums),1):
        sum = sum + (int(nums[i]) ^ int(nums[j]))
        #print(str(i) +' ' + str(j))
print(sum %(10**9 + 7))
