add counting inversion in O(nlogn)