Pregunta de entrevista de Uber

Given a sorted array find out how many duplicates there are, given user input.