$n^2+3n+2 = (n+1)(n+2)$. Now it is clearly seen that one of the two terms $(n+1)$ and $(n+2)$ is even and the other one is odd. According to the question $(n+1)(n+2)$ should be divisible by 6. Total number of elements in S is 26.
Rather than finding n for which $(n+1)(n+2)$ is divisible by 6 it is easier to find n for which $(n+1)(n+2)$ is not divisible by 6.
Now $(n+1)(n+2)$ is not divisible by 6 iff none of them is not divisible by 3 as there is an even number already present. If any $(n+1)$ or $(n+2)$ is divisible by 3 then the number $(n+1)(n+2)$ will be divisible by $6$. It is only possible that $(n+1)(n+2)$ is not divisible by 6 if n is divisible by $3$ because if $n$ is not divisible by $3$ then either $(n+1)$ or $(n+2)$ will be divisible by $3$.
There are $\frac{25}{3} = 9 $ (including 0) numbers are there which are divisible by 3.
The answer is $(26-9) = 17$ (Option B)