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

B =[]
answer = 0
for i in range(N):
    n = list(bin(A[i]))
    del n[0]
    del n[0]
    B.append(n)

for i in range(N):
    for j in range(i+1,N):
        if len(B[i]) > len(B[j]):
            sa = len(B[i]) - len(B[j])
            for n in range(len(B[j])):
            #print(m-n)
                #print(B[i][n+sa],B[j][n])
                if B[i][n+sa]!=B[j][n]:
                    answer += 2**(len(B[j])-n-1)
            for l in range(sa):
                answer += int(B[i][l])*(2**(len(B[i])-l-1))
        if len(B[i]) < len(B[j]):
            sa = len(B[j]) - len(B[i])
            for n in range(len(B[i])):
            #print(m-n)
            #print(B[i][m-n],B[j][m-n])
                #print(i,j,n,sa,B[j][n+sa],B[i][n])
                if B[j][n+sa]!=B[i][n]:
                    answer += 2**(len(B[i])-n-1)
            for l in range(sa):
                answer += int(B[j][l])*(2**(len(B[j])-l-1))
        if len(B[i]) == len(B[j]):
            for n in range(len(B[i])):
                if B[j][n]!=B[i][n]:
                    answer += 2**(len(B[i])-n-1)


print(answer%(10**9+7))
