N = int(input())

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