Complete countInversions