count inversion clean