N = int(input())
A = list(map(int, input().split()))
# print(*A)

# print(bin(A[0]))
# print(format(A[0], "b"))

result = 0

for i in range(N):
    for j in range(N):
        # ai= format(A[i], "b")
        # aj= format(A[j], "b")
        ai = A[i]
        aj = A[j]
        xor = ai^aj
        # print(xor)
        # print(ai,aj,format(xor,"b"))
        result += int(xor)

print(int(result/2)%(10**9+7))

def xor(ai, aj): #str
    pass
