4. If the edge length of the cube $A_{1} A_{2} A_{3} A_{4}-B_{1} B_{2} B_{3} B_{4}$ is 1, then the number of elements in the set $\left\{x \mid x=\overrightarrow{A_{1} B_{1}} \cdot \overrightarrow{A_{i} B_{j}}, i \in\right.$ $\{1,2,3,4\}, j \in\{1,2,3,4\}\}$ is $\qquad$.
4. 1 .
(Method 1) Since $\overrightarrow{A_{1} B_{1}} \perp \overrightarrow{A_{i} A_{1}}, \overrightarrow{A_{1} B_{1}} \perp \overrightarrow{B_{1} B_{j}}$, where $i, j \in\{1,2,3,4\}$, we have
$$
\begin{aligned}
\overrightarrow{A_{1} B_{1}} \cdot \overrightarrow{A_{i} B_{j}} & =\overrightarrow{A_{1} B_{1}} \cdot\left(\overrightarrow{A_{i}} \overrightarrow{A_{1}}+\overrightarrow{A_{1} B_{1}}+\overrightarrow{B_{1} B_{j}}\right) \\
& =\overrightarrow{A_{1} B_{1}} \cdot \overrightarrow{A_{i} A_{1}}+\overrightarrow{A_{1} B_{1}}+\overrightarrow{A_{1} B_{1}} \cdot \overrightarrow{B_{1} B_{j}} \\
& ={\overrightarrow{A_{1} B_{1}}}^{2}=1 .
\end{aligned}
$$
(Method 2) As shown in Figure 2, for any $i, j \in\{1,2,3,4\}$, the projection of vector $\overrightarrow{A_{i} B_{j}}$ onto $\overrightarrow{A_{1} B_{1}}$ is $\overrightarrow{A_{1} B_{1}}$, hence $\overrightarrow{A_{1} B_{1}} \cdot \overrightarrow{A_{i} B_{j}}=1$