Inversion counting algorithm implementations.