Write binary search!
Find the position(index) of the last occurence of X in a sorted array! If no X in the array, return the position to insert X to keep the array sorted.
Example
Input:
5 - number of elements in the array
1 10 20 45 67 - elements of the array
10 - X
Output:
1