11. (20 points) Let $a_{1} \in \mathbf{Z}_{+}$, and $a_{1} \leqslant 18$, define the sequence $\left\{a_{n}\right\}$:
$$
a_{n+1}=\left\{\begin{array}{ll}
2 a_{n}, & a_{n} \leqslant 18 ; \\
2 a_{n}-36, & a_{n}>18
\end{array}(n=1,2, \cdots) .\right.
$$

Find the maximum number of elements in the set $M=\left\{a_{n} \mid n \in \mathbf{Z}_{+}\right\}$.