int_i = int(input())
result = list()
s_x = input().split(' ')
i_x = list([int(n) for n in s_x])
for i in range(int_i):
    for hoge in i_x[i + 1:]:
        if i_x[i] == hoge:
            continue
        result.append(int(bin(i_x[i] ^ hoge), 2))
print(sum(result) % (10 ** 9 + 7))