import List main=interact$f[].sortBy((.n).compare.n).lines n=(0-).read.last.words f _[]="" f x(h:t)=(show(1+sum[1|y<-x,y