Try in A2:

=COUNTIF($B$2:B2,B2)

copied down.