Array is already sorted, so to count element that appears max number of times in this array, O(n) time is required.
Take two variables max and count and initialize them as 0 and 1 resp
For i=2 to n
If a(i) is not same as a(i-1), Check whether count > max, then assign count to max and reset count as 1.
else count ++
At the end of the loop max contains maximum no of times any element has repeated.
If the majority element is also required maintain a variable key and update it accordingly with max.
if max is 1 then majority element does not exists.