Uber interview question

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