3. Let $M=\{1,2, \cdots, 2009\}$. If $n \in M$, such that $S_{n}=\frac{1}{n}\left(1^{3}+2^{3}+\cdots+n^{3}\right)$ is a perfect square, then the number of such $n$ is $\qquad$.


3. 44 .

Notice that
$$
S_{n}=\frac{1}{n}\left[\frac{n(n+1)}{2}\right]^{2}=\frac{n(n+1)^{2}}{4} \text {. }
$$

Since $n$ and $n+1$ are coprime, if $S_{n}$ is a perfect square, then $n$ must be a perfect square. When $n$ is an even perfect square, $\frac{n}{4}$ is a perfect square integer; when $n$ is an odd perfect square, $\frac{(n+1)^{2}}{4}$ is a perfect square integer. Therefore, $n$ can take all the perfect squares in $M$, and there are 44 such numbers.