n = int(input())
a_list = list(map(int, input().split()))

all_sum = 0
for i in range(n):
    for j in range(i+1, n):
        # print("i:{}, j:{}, xor:{}".format(i, j, a_list[i] ^ a_list[j]))
        mod_num = (a_list[i] ^ a_list[j]) % (10 ** 9 + 7)
        all_sum += mod_num

print(all_sum)