n = int(input())
a_list = [int(i) for i in input().split()]
divide = 10 ** 9 + 7

sum = 0
for i in range(n):
    for j in range(i+1, n):
        # print(a_list[i], a_list[j] , a_list[i] ^ a_list[j])
        sum += (a_list[i] ^ a_list[j])

print(sum % divide)