7. If the union of two sets $A$ and $B$ has two elements, and $f(A)$ denotes the number of elements in $A$, $f(B)$ denotes the number of elements in $B$, then the number of such pairs $(f(A), f(B))$ is $\qquad$ pairs.
7. 6 .

Let $A \cup B=\left\{a_{1}, a_{2}\right\}$, then when $A=\varnothing$, $B=\left\{a_{1}, a_{2}\right\}$; when $A=\left\{a_{1}\right\}$, $B=\left\{a_{2}\right\}$ or $\left\{a_{1}, a_{2}\right\}$; when $A=\left\{a_{2}\right\}$, $B=\left\{a_{1}\right\}$ or $\left\{a_{1}, a_{2}\right\}$; when $A=\left\{a_{1}, a_{2}\right\}$, $B=\varnothing$ or $\left\{a_{1}\right\}$ or $\left\{a_{2}\right\}$ or $\left\{a_{1}, a_{2}\right\}$. At this point, the pairs $(f(A), f(B))$ are $(0,2)$, $(1,1)$, $(1,2)$, $(2,0)$, $(2,1)$, $(2,2)$, a total of 6 pairs.