num = int(input())
num_list = [int(x) for x in input().split(" ")]
taken_list = num_list.copy()
count = 0
for x in num_list:
    taken_list.remove(taken_list[0])
    for y in taken_list:
        count += x ^ y
print(count%(pow(10, 9)+7))