First correct inverstions count calculation