8. For the sequence $\left\{n^{2}-n+1\right\}(n=1,2, \cdots)$, if we arbitrarily add a “+” or “-” sign before each of the first 1991 terms, what is the smallest non-negative value of the algebraic sum that can be obtained?
8. Let $f(n)=n^{2}-n+1(n=1,2, \cdots)$, then we have
$$
f(n+1)-f(n)-f(n-1)+f(n-2)=4 \text {. }
$$

From the above equation, we know that for the sequence $\left\{n^{2}-n+1\right\}$, there is a way to add “+” or “-” signs between any four consecutive terms such that their algebraic sum is 4 or -4. Therefore, there exists a way to add signs such that the algebraic sum of any eight consecutive terms is 0, 8, or -8. Since $1991=248 \times 8+7$, there exists a way to add signs such that the algebraic sum of the terms starting from the eighth term is -8.
And $f(1)-f(2)+f(3)+f(4)-f(5)-f(6)+f(7)=1-3+7+13-21-31+43=9$,
From this, we know that there exists a way to add signs such that the algebraic sum of the first 1991 terms of the sequence $\left\{n^{2}-n+1\right\}$ is 1. Also, since $f(n)=n(n-1)+1$ is an odd number and 1991 is an odd number, the algebraic sum of the first 1991 terms of the sequence $\left\{n^{2}-n+1\right\}$, regardless of whether “+” or “-” signs are added before each term, is always an odd number. Therefore, the smallest non-negative value is 1.