Number occurrences in another cell (Excell)

In the example below there's a columnA with names and a columnB counting how many instances that the name occurs. How can I write a formula for ColumnB that I can paste so I don't have to manually count the number of occurrences of each name.

Note: The names are sorted so they are grouped together and the count stars back at one when there's a new name.

Thanks for your help!

enter image description here

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum