$2 \cdot 109$ Let $S=\left\{A=\left(a_{1}, \cdots, a_{8}\right) \mid a_{i}=0\right.$ or $\left.1, i=1,2, \cdots, 8\right\}$. For two elements $A=\left(a_{1}, \cdots, a_{8}\right)$ and $B=\left(b_{1}, \cdots, b_{8}\right)$ in $S$, let
$$d(A, B)=\sum_{i=1}^{8}\left|a_{i}-b_{i}\right|,$$

and call it the distance between $A$ and $B$. How many elements can be selected from $S$ at most, such that the distance between any two of them is $\geqslant 5$?
[Solution] $S^{\prime}$ is a subset of $S$, and the distance between any two elements in $S^{\prime}$ is $\geqslant 5$. Let $A=\left(a_{1}, \cdots, a_{8}\right)$ and $B=\left(b_{1}, \cdots, b_{8}\right)$ be two elements in $S^{\prime}$, and let
$$\omega(A)=\sum_{i=1}^{8} a_{i}, \omega(B)=\sum_{i=1}^{8} b_{i}$$

Clearly, $\omega(A), \omega(B)$ represent the number of 1s in $A, B$ respectively.
If $\omega(A)+\omega(B) \geqslant 12$,
then $A$ and $B$ must have at least 4 positions with 1s in common, thus
$$d(A, B) \leqslant 8-4=4,$$

which contradicts the definition of $S^{\prime}$. Therefore, it must be that
$$\omega(A)+\omega(B) \leqslant 11.$$

From the above, we know that among the elements of $S^{\prime}$, there can be at most one element with the number of 1s $\geqslant 6$.

Assume $(0,0,0,0,0,0,0,0) \in S^{\prime}$. (This is because we can simultaneously change the $i$-th component of every element in $S^{\prime}$ from 1 to 0 or from 0 to 1 without changing the properties of $S^{\prime}$)

Thus, the number of 1s in the other elements of $S^{\prime}$ is $\geqslant 5$. If $S^{\prime}$ contains two elements with 5 1s, then by $5+5-8=2$, these two elements must have at least two positions with 1s in common. Since the distance between these two elements is $\geqslant 5$, they can have at most two positions with 1s in common. Therefore, any two elements in $S^{\prime}$ with 5 1s must have exactly two positions with 1s in common. Hence, $S^{\prime}$ can contain at most two elements with 5 1s.

From the above discussion, $S^{\prime}$ can contain at most 4 elements. One of them is the all-zero element, one has the number of 1s $\geqslant 6$, and two have the number of 1s $=5$.

On the other hand, $S^{\prime}$ can be composed of the following 4 elements:
$(0,0,0,0,0,0,0,0)$,
$(1,1,1,0,0,1,1,1)$,
$(1,1,1,1,1,0,0,0)$,
$(0,0,0,1,1,1,1,1)$.
Therefore, in $S$, the maximum number of elements that can be selected such that the distance between any two is $\geqslant 5$ is 4.