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

xor_sum = 0
for i in range(len(a_list) - 1):
    for j in range(i + 1, len(a_list)):
        xor_sum += int(bin(a_list[i]), 2) ^ int(bin(a_list[j]), 2)

print(xor_sum % (10 ** 9 + 7))
