6. The minimum value of the function $f(x)=\sum_{n=1}^{19}|x-n|$ is ( ).
(A) 90
(B) 171
(C) 190
(D) 45
6.A.
$$
\begin{array}{l}
f(x)=\sum_{n=1}^{19}|x-n| \\
=\sum_{n=1}^{9}|x-n|+|x-10|+\sum_{n=11}^{19}|x-n| \\
\geqslant\left|\sum_{n=1}^{9}(x-n)\right|+\left|\sum_{n=11}^{19}(n-x)\right|+|x-10| \\
\geqslant\left|\sum_{n=1}^{9}(x-n)+\sum_{n=11}^{19}(n-x)\right|=90,
\end{array}
$$

The equality holds if and only if \( x=10 \).