Let $S$ be the set of natural numbers that cannot be written as the sum of three squares. Legendre's three-square theorem states that $S$ consists of precisely the integers of the form $4^a(8b+7)$ where $a$ and $b$ are nonnegative integers. Find the smallest $n \in \mathbb{N}$ such that $n$ and $n+1$ are both in $S$.

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