Problem

Source: All Russian 2014 Grade 10 Day 1 P3

Tags: induction, combinatorics proposed, combinatorics



There are $n$ cells with indices from $1$ to $n$. Originally, in each cell, there is a card with the corresponding index on it. Vasya shifts the card such that in the $i$-th cell is now a card with the number $a_i$. Petya can swap any two cards with the numbers $x$ and $y$, but he must pay $2|x-y|$ coins. Show that Petya can return all the cards to their original position, not paying more than $|a_1-1|+|a_2-2|+\ldots +|a_n-n|$ coins.