<prompt> Kutokana na idadi kamili safu nums, kurudi safu jibu ambapo jibu i ni idadi ya vipengele vidogo upande wa kulia wa nums i.  <response>: This problem can be solved using a modified merge sort algorithm.1. First, create a helper function that takes in an input array, left index, and right index. This helper function will divide the input array into two halves and recursively call itself on each half. 2. When the base case is reached only one element, return that element. 3. While merging the two sorted halves, keep track of how many elements in the right half are smaller than the current element in the left half. This can be done by keeping a count variable that gets incremented every time an element in the right half is chosen to be merged before an element in the left half.4. Update the answer array with the count for each element in the input array.5. Return the answer array.Heres some sample code to demonstrate the algorithm:def countSmallernums: def mergeSortnums, left, right: if left right: base case return numsleft mid left right 2 left_half mergeSortnums, left, mid right_half mergeSortnums, mid 1, right i, j, count 0, 0, 0 merged while i lenleft_half and j lenright_half: if left_halfi right_halfj: merged.appendleft_halfi answerleft i count j update answer array i 1 else: merged.appendright_halfj j 1 count 1 merged left_halfi: merged right_halfj: return merged answer 0 lennums mergeSortnums, 0, lennums - 1 return answerNote: this algorithm has a time complexity of Onlogn because it uses a modified merge sort algorithm, which is a divide-and-conquer algorithm with Onlogn time complexity. 