Consider the set of integers $\{1,2,...,100\}$. Let $\{x_1,x_2,...x_{100}\}$ be some arbitrary arrangement of the integers $\{1,2,...,100\}$ where all of the $x_i$ are different. Find the smallest possible value of the sum

\[ S=|x_2-x_1|+|x_3-x_2|+...+|x_{100}-x_{99}|+|x_1-x_{100}| \]

I could partially solve it. But how to deal with this more accurately?