$$n/2 \le \sum_{k=1}^{n/2} (\sigma(2k)-\sigma(2k-1))^2= \sum_{l=1}^n l^2 - 2S(\sigma)$$
with equality if and only if $|\sigma(2k)-\sigma(2k-1)|=1$ for all $k$.
$\bf{Added:}$ Inspired by this, the following natural problem: given $n = 2k$ (distinct) numbers, how to group them into groups of $2$ so that the sum of products in groups is maximal. The solution is grouping the numbers in order, first $2$, then the next $2$, and so on. To show maximality, it is enough to show that considering the maximizing grouping, the segments $[a_{2i-1}, a_{2i}]$ and $[a_{2j-1}, a_{2j}]$ do not intersect. Now, if they did, we could still increase the sum. We see that we have reduced the argument to the case $k=2$.
As a generalization, how to group $m k$ (positive- this cannot be avoided now) numbers into groups of $m$ such that the sum of the products in the groups is maximal. Again, we have the maximizing solution of grouping in increasing order.
Proof: We reduce to the case $n = 2m$ positive numbers and want to divide them into two groups of size $m$ of such that the sum of the two products is maximum.
Consider the maximum sum
$$a_1\ldots a_m + a_{m+1} \ldots a_{2m}$$
Say we have $p=a_1\ldots a_m\le q=a_{m+1} \ldots a_{2m}$. Now, consider indexes $i\in \{1,\ldots,m\}$ and $j\in \{m+1, \ldots, 2m\}$. Since of the maximality (otherwise we could swap $a_i$ and $a_j$) we have
$$(a_i -a_j)(p/a_i - q/a_j)\ge 0$$
that is, $(a_i, a_j)$ and $(p/a_i, q/a_j)$ are ordered in the same way, and so are $(p, q)$. We conclude $a_i \le a_j$