Pergunta de entrevista da empresa Uber

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