26.20*. (Jury, Luxembourg, 83). In a space with a rectangular coordinate system, consider the set $E$ of points with integer coordinates taking values from 0 to 1982. Each of these points is colored either red or blue. How many colorings exist that have the following property: the number of red vertices of any parallelepiped (with vertices from $E$ and edges parallel to the axes) is divisible by 4?

## § 27. Elements of Probability Theory

$$
\begin{gathered}
\text { (see Appendix } \Gamma: \text { definitions 18, 46-49; } \\
\text { theorems 95, 96. 98-100) }
\end{gathered}
$$
26.20. First, we prove that the coloring of points in the set \(E\) satisfies the condition of the problem if and only if any rectangle with vertices from \(E\) and sides parallel to the axes has an even number of red vertices. Suppose the number of red vertices of some rectangle \(\Gamma_{0}\) is odd and, for example, equals 1 (the case with 3 red vertices is considered similarly). Consider two different parallelepipeds with one face \(\Pi_{0}\) and opposite faces \(\Pi_{1}\) and \(\Pi_{2}\) respectively. Then, if the coloring satisfies the condition of the problem, each of the faces \(\Pi_{1}\) and \(\Pi_{2}\) has 3 red vertices, and the parallelepiped with faces \(\Pi_{1}, \Pi_{2}\) has 6 red vertices, which contradicts the assumption. Now, let every rectangle have an even number of red vertices. Consider an arbitrary parallelepiped. If all its vertices are of the same color, then the number of red vertices is divisible by 4. If not all vertices are of the same color, then there exists an edge with vertices of different colors, and all edges parallel to it also have vertices of different colors (since each face has an even number of red vertices), and the number of red vertices of the parallelepiped is 4. The statement is proved. Let the colors of \((1+3 \cdot 1982)\) points \((0; 0; 0), (x; 0; 0), (0; y; 0), (0; 0; z)\) be given, where \(x, y, z\) take all integer values from 1 to 1982. We prove that there exists a unique coloring of the remaining points from \(E\) that satisfies the condition of the problem. For the proof, consider the function

\[
f(x, y, z)=\left\{\begin{array}{l}
0, \text { if the point } (x; y; z) \text { is red, } \\
1, \text { if the point } (x; y; z) \text { is blue; }
\end{array}\right.
\]

the color of the point \((x; y; z)\) is uniquely determined by the value of \(f(x, y, z)\). Define the operation \(a \oplus b\) (addition modulo 2) as follows:

\[
a \oplus b=\left\{\begin{array}{l}
0, \text { if the number } a+b \text { is even, } \\
1, \text { if the number } a+b \text { is odd. }
\end{array}\right.
\]

Now, let

\[
f(x, y, z)=f(x, 0,0) \oplus f(0, y, 0) \oplus f(0,0, z)
\]

Verification shows that this formula is also valid for the previously given points, and any rectangle with edges parallel to the axes has an even number of red vertices (for example,

\[
f\left(x_{1}, y_{1}, z\right) \oplus f\left(x_{2}, y_{1}, z\right) \oplus f\left(x_{1}, y_{2}, z\right) \oplus f\left(x_{2}, y_{2}, z\right)=0
\]

i.e., according to the proven statement, the obtained coloring satisfies the condition of the problem. By the same statement, this coloring is unique, as it must satisfy the following conditions:

\[
\begin{gathered}
f(x, y, 0)=f(0,0,0) \oplus f(x, 0,0) \oplus f(0, y, 0) \\
f(x, 0, z)=f(0,0,0) \oplus f(x, 0,0) \oplus f(0,0, z) \\
f(0, y, z)=f(0,0,0) \oplus f(0, y, 0) \oplus f(0,0, z) \\
f(x, y, z)=f(0,0, z) \oplus f(x, 0, z) \oplus f(0, y, z)= \\
=f(0,0, z) \oplus(f(0,0,0) \oplus f(x, 0,0) \oplus f(0,0, z)) \oplus \\
\quad \oplus(f(0,0,0) \oplus f(0, y, 0) \oplus f(0,0, z))= \\
\quad=f(x, 0,0) \oplus f(0, y, 0) \oplus f(0,0, z)
\end{gathered}
\]

Thus, the number of sought colorings is

\[
2^{1+3 \cdot 1982}=2^{5947}
\]

## § 27. Elements of Probability Theory