main=interact$show.(<$>[4,14]).(%) l%s|l<-take s l,sum[1|x<-l,y<-l,x==y]==s=s|(_:l)<-l=1+l%s