7. 8 .
$$
M=\{3,6,9,12\}, P=\{3,9,27\}, M \cap P=\{3,9\}, M \cup P=\{3,6,9,12,27\} \text {, }
$$

From the problem, $S=\{3,9\} \cup A$, where $A \subseteq\{6,12,27\}$. There are $2^{3}=8$ (sets).
7. Given the sets $M=\{x \mid x=3 n, n=1,2,3,4\}, P=\left\{x \mid x=3^{k}, k=\right.$ $1,2,3\}$. If there is a set $S$ that satisfies the condition $(M \cap P) \subseteq S \subseteq(M \cup P)$, then there are $\qquad$ such $S$.