applies inversion counter to a big array