This function sorts the input array and returns the number of inversions in the array
function mergeSort ( arr , array_size ) { let temp = Array . from ( { length : array_size } , ( _ , i ) => 0 ) ; return _mergeSort ( arr , temp , 0 , array_size - 1 ) ; }