Let $S$ be a subset of $\{1,2,\dots,2017\}$ such that for any two distinct elements in $S$, both their sum and product are not divisible by seven. Compute the maximum number of elements that can be in $S$.

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