N = int(input())

A = list(map(int, input().split()))
AList = [bin(i) for i in A]
AList = [int(i, 2) for i in AList]
count = 0
for i in range(0, N):
    for q in range(i, N):
        count += int(bin(AList[i] ^ AList[q]), 2)
print(count % (10 ** 9 + 7))