N=int(input())
A=list(map(int,input().split()))
P=10**9+7
ans=0
BIN=[0]*N
for h in range(N):
    BIN[h]=bin(A[h])[2:].zfill(60)

for i in range(N-1):
    for j in range(i+1,N):
        ans+=A[i]^A[j]
print(ans%P)