Three. (25 points) Given $x_{1}, x_{2}, \cdots, x_{2021}$ take values of 1 or $-\mathrm{i}$, let
$$
\begin{aligned}
S= & x_{1} x_{2} x_{3}+x_{2} x_{3} x_{4}+\cdots+x_{2019} x_{2020} x_{2021}+ \\
& x_{2020} x_{2021} x_{1}+x_{2021} x_{1} x_{2} .
\end{aligned}
$$

Find the smallest non-negative value that $S$ can take.
$$
\text { Three, let } y_{i}=x_{i} x_{i+1} x_{i+2}(i=1,2, \cdots, 2021) \text {, }
$$

with the convention $x_{2022}=x_{1}, x_{2023}=x_{2}$. Then $y_{i}=1$ or -1.
In $y_{1}, y_{2}, \cdots, y_{2021}$, let there be $a$ values of 1 and $b$ values of -1. Clearly,
$$
a+b=2021, S=a-b=2021-2 b \geqslant 0,
$$

Thus, the integer $b \leqslant 1010$.
In a sequence of five numbers arranged as $1,1,-1,1,1$, the product of any three consecutive numbers is -1 for three times, which is denoted as "Type A";

In a sequence of six numbers arranged as $1,1,-1,-1,1,1$, the product of any three consecutive numbers is -1 for two times, which is denoted as "Type B";

In a sequence of seven numbers arranged as $1,1,-1,1,-1,1,1$, the product of any three consecutive numbers is -1 for four times, which is denoted as "Type C".
$$
\begin{array}{l}
\text { From } 1^{a}(-1)^{b}=y_{1} y_{2} \cdots y_{2021} \\
=\left(x_{1} x_{2} \cdots x_{2021}\right)^{3}= \pm 1 \\
\Rightarrow(-1)^{b}= \pm 1 .
\end{array}
$$

When $(-1)^{b}=1$, $b$ is even, and there are an even number of -1 in $y_{1}, y_{2}, \cdots, y_{2021}$. In this case, the maximum value of $b$ is 1010, $S_{\text {min }}=1$, and the values of $x_{i}$ are 252 Type C, 1 Type B, and the rest are 1.

When $(-1)^{b}=-1$, $b$ is odd, and there are an odd number of -1 in $y_{1}, y_{2}, \cdots, y_{2021}$. In this case, the maximum value of $b$ is 1009, $S_{\text {min }}=3$, and the values of $x_{i}$ are 251 Type C, 1 Type A, 1 Type B, and the rest are 1.
In summary, the smallest non-negative value that $S$ can take is 1.
$$