Counting Inversions Coding Problem** Inversion There is an array(a) and two indexes i and j. Inversion is the…