n = int(input())
a = [int(j) for j in input().split()]

xor = []
for i in range(1, n):
    for j in range(i + 1, n + 1):
        xor.append(int(bin(a[i - 1] ^ a[j - 1]), 0))

print(sum(xor)%(pow(10, 9) + 7))
