The answer should be O(n). In the worst case even if we go by linear search then to find the number of times the duplicate key is present then also it would take O(n) as the array would be traversed once.
if we use Binary search then after the particular key element that we are searching for is found we have to go both in the left and the right direction to count the no. of duplicate elements. So it will require additional time in comparison to O(logn).