add counting-inversion