Code giving wrong output

I am trying to run my inversion count code but its giving wrong output

Hey @ayushi1150