Let $A = {1, 2, 3, 4, 5}$. Find the number of functions $f$ from the nonempty subsets of $A$ to $A$, such that $f(B) \in B$ for any $B \subset A$, and $f(B \cup C)$ is either $f(B)$ or $f(C)$ for any $B$, $C \subset A$
Source: Turkey TST 1998 Problem 3
Tags: function, combinatorics proposed, combinatorics
Let $A = {1, 2, 3, 4, 5}$. Find the number of functions $f$ from the nonempty subsets of $A$ to $A$, such that $f(B) \in B$ for any $B \subset A$, and $f(B \cup C)$ is either $f(B)$ or $f(C)$ for any $B$, $C \subset A$