Code Explanation for LEPERMUT @qzthrone

Hi
I tried to figure it out, but I didn’t get. can any one explain this code. what exactly doing.

for i in range(N):
	A[i] -= i + 1;
	if A[i] > 0:
		inversions += A[i];
	elif A[i] < -1:
		inversions -= A[i] + 1;

It’s about logic, what he/she righten.
click here for orginal code

//