
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system

Let \( n \) be a given positive integer. The sum

$$
\begin{aligned}
\sum_{1 \leqslant i<j \leqslant n}\left| x_i - x_j \right| = & \left| x_1 - x_2 \right| + \left| x_1 - x_3 \right| + \cdots + \left| x_1 - x_n \right| + \\
& \left| x_2 - x_3 \right| + \left| x_2 - x_4 \right| + \cdots + \left| x_2 - x_n \right| + \\
& \cdots + \left| x_{n-2} - x_{n-1} \right| + \left| x_{n-2} - x_n \right| + \left| x_{n-1} - x_n \right|,
\end{aligned}
$$

where \( 0 \leqslant x_i \leqslant 1 \) for \( i = 1, 2, \ldots, n \). Let \( S(n) \) denote the maximum possible value of this sum. Find \( S(n) \).

Present the answer in LaTex format: \boxed{Your answer}
user