N = int(input())
S = input().split()
A = []
Su = 0
for c in S:
    A.append(int(c))
for i in range(N):
    # print(i)
    B = int(bin(A[i])[2:])
    for j in range(i+1, N):
        C = int(bin(A[j])[2:])
        D = str(B+C)
        D = D.replace("2", "0")
        Su += int(D, 2)
print(Su % (10**9+7))