Let $A$ and $B$ be two finite sets such that there are exactly $144$ sets which are subsets of $A$ or subsets of $B$. Find the number of elements in $A \cup B$.

Let's think step by step and output the final answer within \boxed{}.
user