Count inversion code.