3. Find all positive integers $n$, such that the numbers in the set $S=$ $\{1,2, \cdots, n\}$ are colored red or blue, and satisfy the following condition: the set $S \times S \times S$ contains exactly 2007 ordered triples $(x, y, z)$, such that
(1) $x, y, z$ are of the same color;
(2) $x+y+z$ is divisible by $n$.
3. $n=69$ and $n=84$.

Assume $1,2, \cdots, n$ are colored red and blue, denoted by $R$ and $B$ for the sets of red and blue numbers, respectively.
Let $|R|=r,|B|=b=n-r$.
If $x, y, z$ are of the same color, then the triplet $(x, y, z) \in S \times S \times S$ is called "monochromatic"; otherwise, it is called "bichromatic".

If $x+y+z$ is divisible by $n$, then the triplet $(x, y, z)$ is called "divisible".

We will prove that there are exactly $r^{2}-r b+b^{2}$ "divisible monochromatic" triplets.

For any pair $(x, y) \in S \times S$, there exists a unique $z_{x, y} \in S$ such that the triplet $\left(x, y, z_{x, y}\right)$ is divisible. Therefore, there are exactly $n^{2}$ divisible triplets. Moreover, if a divisible triplet is bichromatic, then $x, y, z$ either have one blue and two reds, or two blues and one red. In both cases, exactly one of the pairs $(x, y), (y, z), (z, x)$ belongs to the set $R \times B$. Thus, this pair can be "assigned" to the triplet $(x, y, z)$.

Conversely, consider any pair $(x, y) \in R \times B$. Let $z=z_{x, y}$.

Since $x \neq y$, the triplets $(x, y, z), (y, z, x), (z, x, y)$ are pairwise distinct. Therefore, the pair $(x, y)$ can be assigned to each of these three triplets.

On the other hand, if $(x, y)$ is assigned to a certain triplet, then this triplet is one of the three mentioned triplets. Therefore, each pair in $R \times B$ is assigned exactly three times.

Thus, the number of "divisible bichromatic" triplets is three times the number of elements in $R \times B$, and the number of divisible monochromatic triplets is
$$
n^{2}-3 r b=(r+b)^{2}-3 r b=r^{2}-r b+b^{2} \text {. }
$$

Let $r^{2}-r b+b^{2}=2007$. Then
$$
9 \mid\left(r^{2}-r b+b^{2}\right)=(r+b)^{2}-3 r b \text {. }
$$

Thus, $3 \mid (r+b)^{2}$, and $3 \mid (r+b)$.
Therefore, $3 \mid r b$.
Regardless of whether $r$ or $b$ is divisible by 3, the other is also divisible by 3.
Let $r=3 s, b=3 c$.
Assume $s \geqslant c$, then,
$$
\begin{array}{l}
s^{2}-s c+c^{2}=223 . \\
\text { By } 892=4\left(s^{2}-s c+c^{2}\right) \\
=(2 c-s)^{2}+3 s^{2} \geqslant 3 s^{2} \geqslant 3 s^{2}-3 c(s-c) \\
=3\left(s^{2}-s c+c^{2}\right)=669,
\end{array}
$$

Therefore, $297 \geqslant s^{2} \geqslant 223$, i.e., $17 \geqslant s \geqslant 15$.
$$
\begin{array}{l}
\text { If } s=15 \text {, then } \\
c(15-c)=c(s-c) \\
=s^{2}-\left(s^{2}-s c+c^{2}\right)=15^{2}-223=2
\end{array}
$$

No integer solution;
If $s=16$, then $c(16-c)=33$, also no integer solution;

If $s=17$, then $c(17-c)=66$, the solutions are $c=6$ and $c=11$.
Thus, $(r, b)=(51,18)$ or $(51,33)$.
Therefore, the possible values of $n$ are