22. Let $i_{1}, i_{2}, \cdots, i_{10}$ be a permutation of $1,2, \cdots, 10$, and let
$$
S=\left|i_{1}-i_{2}\right|+\left|i_{3}-i_{4}\right|+\cdots+\left|i_{9}-i_{10}\right| .
$$

Find all possible values of $S$.
22. Note that,
$$
\begin{array}{l}
S \geqslant 1+1+1+1+1=5, \\
S \leqslant 6+7+\cdots+10-(1+2+\cdots+5)=25,
\end{array}
$$

and $S \equiv \sum_{k=1}^{10} k(\bmod 2) \equiv 1(\bmod 2)$.
We will prove below that: $S$ can take all odd numbers from $5 \sim 25$. Let
$$
f\left(i_{2}, i_{4}, i_{6}, i_{8}, i_{10} ; i_{1}, i_{3}, i_{5}, i_{7}, i_{9}\right)
$$

be the $S$ corresponding to the permutation $i_{2}, i_{4}, i_{6}, i_{8}, i_{10} ; i_{1}, i_{3}, i_{5}, i_{7}, i_{9}$. Then
$$
\begin{array}{l}
f(1,2,3,4,6 ; 5,7,8,9,10)=23, \\
f(1,2,3,4,7 ; 5,6,8,9,10)=21, \\
f(1,2,3,4,8 ; 5,6,7,9,10)=19, \\
f(1,2,3,4,9 ; 5,6,7,8,10)=17, \\
f(1,2,3,5,9 ; 4,6,7,8,10)=15, \\
f(1,2,3,6,9 ; 4,5,7,8,10)=13, \\
f(1,2,3,7,9 ; 4,5,6,8,10)=11, \\
f(1,2,4,7,9 ; 3,5,6,8,10)=9, \\
f(1,2,5,7,9 ; 3,4,6,8,10)=7 .
\end{array}
$$

Therefore, the values that $S$ can take are
$$
5,7,9,11,13,15,17,19,21,23,25 \text {. }
$$