8. Let the set $A=\{1,2, \cdots, n\}$. If there exist non-empty sets $B$ and $C$ such that $B \cap C=\varnothing, B \cup C=A$, and the sum of the squares of the elements in $B$ is $M$, the sum of the squares of the elements in $C$ is $N$, satisfying $M-N=2016$, find the minimum value of $n$.
8. The minimum value of $n$ is 19.

Notice that, $\sum_{i=1}^{17} i^{2}<2016$.
Thus, $n \geqslant 18$.
When $n=18$, $\sum_{i=1}^{18} i^{2}$ is odd, which means $M+N$ is odd, and thus $M-N$ is odd, which does not satisfy the condition. Hence, $n \geqslant 19$.
When $n=19$,
$$
\begin{array}{l}
\sum_{i=1}^{19} i^{2}-2016=454, \\
\frac{454}{2}=227=13^{2}+7^{2}+3^{2}=11^{2}+9^{2}+5^{2},
\end{array}
$$

Therefore, when $C=\{3,7,13\}$, the condition is satisfied.
In conclusion, the minimum value of $n$ is 19.