Given the set $S = \{ xy(x + y) \mid x, y \in \mathbb{N} \}$. Let $a$ and $n$ be natural numbers such that $a + 2^k \in S$ for all $k = 1, 2, 3, \ldots, n$. Find the greatest value of $n$.

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