Let \( S=\{x\in[-\pi,\pi]:\sin x(\sin x+\cos x)=a,\; a\in \mathbb{Z}\} \). Then \( n(S) \) is equal to:
\( 3 \)
\( 6 \)
\( 7 \)
\( 9 \)