12. For any positive integer $n, Z(n)$ is the smallest positive integer $m$ such that $1+2+\cdots+m$ is a multiple of $n$. Then the sum of all positive integers $n$ that satisfy $Z(n)=6$ is $\qquad$.
12. 28 .

Notice that, $n \left\lvert\, \frac{m(m+1)}{2}\right.$. From $Z(n)=6$, we know $n \left\lvert\, \frac{6 \times 7}{2}\right.$.
Thus, $n=1,3,7,21$.
Upon verification, $n=7,21$.
Therefore, the answer is $7+21=28$.