n = int(input())
a = list(map(int, (input().split())))
result = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        resultbin = bin(a[i] ^ a[j])
        result += int(resultbin, 2)
print(result % ((10 ** 9) + 7))
