do j=1,n
licz(iclass(j,i))=licz(iclass(j,i))+1
nconf(iclass(j,i),licz(iclass(j,i)))=j
c write (iout,*) i,j,iclass(j,i),licz(iclass(j,i)),
c & nconf(iclass(j,i),licz(iclass(j,i)))
enddo
do j=1,n
licz(iclass(j,i))=licz(iclass(j,i))+1
nconf(iclass(j,i),licz(iclass(j,i)))=j
c write (iout,*) i,j,iclass(j,i),licz(iclass(j,i)),
c & nconf(iclass(j,i),licz(iclass(j,i)))
enddo