implement countMisorderedPairs and fixed removed some code that is not in used