The given problem is to count the number of 1's in an array that is sorted in decreasing order.To solve this problem, we can use binary search.We find the last occurrence of 1 in the array and return its index + 1 as the result.If the mid index is not the last index of 1, we move towards the right half; otherwise, we move towards the left half.