Problem: Karl starts with $n$ cards labeled $1$, $2$, \dots, $n$
lined up in random order on his desk.
He calls a pair $(a,b)$ of cards \emph{swapped} if $a > b$
and the card labeled $a$ is to the left of the card labeled $b$.

Karl picks up the card labeled $1$ and inserts it back into the sequence in
the opposite position: if the card labeled $1$ had $i$ cards to its left,
then it now has $i$ cards to its right.
He then picks up the card labeled $2$ and reinserts it in the same manner,
and so on, until he has picked up and put
back each of the cards $1$, \dots, $n$ exactly once in that order.

For example, if $n = 4$, then one example of a process is
\[ 3142 \longrightarrow 3412 \longrightarrow 2341 \longrightarrow 2431 \longrightarrow 2341 \]
which has three swapped pairs both before and after.

Show that, no matter what lineup of cards Karl started with,
his final lineup has the same number of swapped pairs as the starting lineup.

\end{enumerate}

Solution: The official solution is really tricky.
Call the process $P$.

We define a new process $P'$ where, when re-inserting card $i$,
we additionally change its label from $i$ to $n+i$.
An example of $P'$ also starting with $3142$ is:
\[ 3142 \longrightarrow 3452 \longrightarrow 6345
  \longrightarrow 6475 \longrightarrow 6785. \]
Note that now, each step of $P'$ preserves the number of inversions.
Moreover, the final configuration of $P'$ is the same as
the final configuration of $P$ with all cards incremented by $n$,
and of course thus has the same number of inversions. The end.