12. Using weights labeled $1 \mathrm{~g}, 2 \mathrm{~g}, 3 \mathrm{~g}, 15 \mathrm{~g}, 40 \mathrm{~g}$, each one of them, to weigh objects on a balance scale without graduations. If weights can be placed on both ends of the balance, then the maximum number of different gram weights (positive integer weights) that can be measured on this balance is.
12.55.

Using $1 \mathrm{~g}, 2 \mathrm{~g}, 3 \mathrm{~g}$ these three weights, all integer grams in the interval $A=$ $[1,6]$ can be measured; after adding a $15 \mathrm{~g}$ weight, the measurement range is expanded to the interval $B=[15-6,15+6]=[9,21]$. After adding a $40 \mathrm{~g}$ weight, the measurement range is further expanded to 3 intervals:
$$
\begin{array}{l}
C_{1}=[40-6,40+6]=[34,46], \\
C_{2}=[40-21,40-9]=[19,31], \\
C_{3}=[40+9,40+21]=[49,61] .
\end{array}
$$

However, interval $B$ overlaps with $C_{2}$ by 3 integers. Calculating the number of integers in each of the above intervals, the total number of different grams that can be measured is
$$
6+13+(13+13+13)-3=55 \text { (types). }
$$