7. Given that each of $x_{1}, x_{2}, \cdots, x_{n}$ can only take the values $0,1,-1$, and $S$ represents the sum of the products of any two of $x_{1}, x_{2}, \cdots, x_{n}$: $S=\sum_{1 \leq i<j \leq n} x_{i} x_{j}$. Find the minimum value of $S$.
$$
\text { 7. } \begin{aligned}
S & =\frac{1}{2}\left[\left(x_{1}+x_{2}+\cdots+x_{n}\right)^{2}-\left(x_{1}^{2}+x_{2}^{2}+\cdots+x_{n}^{2}\right)\right] \\
& \geqslant-\frac{1}{2}\left(x_{1}^{2}+x_{2}^{2}+\cdots x_{n}^{2}\right) \geqslant-\frac{n}{2}
\end{aligned}
$$
(1) If $n=2 m$ is even, take $x_{1}=x_{2}=\cdots=x_{m}=1, x_{m+1}=\cdots=x_{2 m}=-1$, then $x_{1}+x_{2}+\cdots+x_{n}=0, S=$ $-\frac{1}{2}\left(x_{1}^{2}+\cdots+x_{n}^{2}\right)=-\frac{n}{2}$. At this time, $S$ takes the minimum value of $-\frac{n}{2}$.
(2) If $n=2 m+1$ is odd, since $S \geqslant-\frac{n}{2}$, and $S$ is an integer, hence $S \geqslant-\frac{n-1}{2}$. Take $x_{1}=\cdots=x_{m+1}=1$, $x_{m+2}=\cdots=x_{2 m+1}=-1$, at this time, $x_{1}+x_{2}+\cdots+x_{n}=1$,
$$
\begin{aligned}
S & =\frac{1}{2}\left[\left(x_{1}+x_{2}+\cdots+x_{n}\right)^{2}-\left(x_{1}^{2}+x_{2}^{2}+\cdots+x_{n}^{2}\right)\right] \\
& =\frac{1}{2}(1-n)=-\frac{1}{2}(n-1) .
\end{aligned}
$$

In summary:
$$
S_{\text {min }}=\left\{\begin{array}{l}
-\frac{n}{2}, n \text { is even; } \\
-\frac{1}{2}(n-1), n \text { is odd. }
\end{array}\right.
$$