Let σ\sigma be a of [n][n]. An inversion is a pair of indices 1i<jn1\le i<j\le n for which σ(i)>σ(j)\sigma(i)>\sigma(j). Write inv(σ)\operatorname{inv}(\sigma) for the number of these pairs. The sign of σ\sigma is

sgn(σ)=(1)inv(σ){+1,1}.\operatorname{sgn}(\sigma)=(-1)^{\operatorname{inv}(\sigma)}\in\{+1,-1\}.
Parity

Thus a permutation is even when its inversion number is even and odd otherwise. The empty permutation has sign +1.

Reference