finished countInversions