if the numbers start in A1, in b2 put

=if(a1=a2,b1+1,"")

Is that what you mean?

Regards

Dav