Let $S_0 = \varnothing$ denote the empty set, and define $S_n = \{ S_0, S_1, \dots, S_{n-1} \}$ for every positive integer $n$. Find the number of elements in the set
\[ (S_{10} \cap S_{20}) \cup (S_{30} \cap S_{40}). \]

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