. Let $A=\{1,2,3,4,5\}$. How many functions $f: \mathscr{P}(A) \backslash\{\varnothing\} \rightarrow A$ satisfy $f(B) \in B$ and $f(B \cup C) \in\{f(B), f(C)\}$ for all non-empty subsets $B$ and $C$ of $A$?
. Let $f$ be a function satisfying the conditions of the statement. Then if $B \subset C \subset A$ satisfy $f(C) \in B$, we have $f(C)=f(B \cup(C \backslash B)) \in\{f(B), f(C \backslash B)\}$. But $f(C) \notin C \backslash B$, so $f(C) \neq f(C \backslash B)$. This shows that $f(C)=f(B)$. We will number the elements of $A$ as follows. Let $a_{1}=f(A)$. Then, for any $B \subset A$ containing $a_{1}, f(B)=a_{1}$ according to the previous argument. Now let $a_{2}=f\left(A \backslash\left\{a_{1}\right\}\right)$. Then for any $B \subset A$ such that $a_{1} \notin B$ and $a_{2} \in B$, we have $f(B)=a_{2}$. Similarly, by setting $a_{3}=f\left(A \backslash\left\{a_{1}, a_{2}\right\}\right)$, for any $B$ such that $a_{1}, a_{2} \notin B$ and $a_{3} \in B$, then $f(B)=a_{3}$. We define $a_{4}$ and $a_{5}$ similarly. Conversely, if we have chosen a numbering $a_{1}, \ldots, a_{5}$ of the elements of $A$, we can associate a function with it as follows: for any $B \in A$, we define $f(B)$ as being equal to $a_{i} \in B$ with $i$ minimal. These functions are all distinct, and it is easily verified that they satisfy the conditions of the statement. Finally, there are as many such functions as there are ways to number the 5 elements of $A$, that is, $5!=120$.