def XOR(a,b):
    s=0
    n=0
    while max(a,b)<=2**n:
        n+=1

    for i in reversed(range(0,n+1)):
        if a//(2**i)==0:
            if b//(2**i)==1:
                s+=2**i
                b-=2**i
        else:
            a-=2**i
            if b//(2**i)==1:
                b-=2**i
            else:
                s+=2**i
    return s

N=int(input())
A=[0]
B=[0]

A=(input().split())
sum=0


for y in range(N):
    B.append(int(A[y]))

for i in range(1,N):
    for j in range(i+1,N+1):
        sum+=XOR(B[i], B[j],60)

ans=sum%(10**9+7)

print(ans)
