Example 4 Let $A$ be a subset of $X=\{1,2,3, \cdots, 1989\}$, such that for any $x, y \in A$, $|x-y| \neq 4$ and 7. Find the maximum value of $|A|$. (7th United States of America Mathematical Olympiad Problem)
Let $A$ be a subset that meets the requirements. For $P=\{1,2, \cdots, 11\}$, we prove that $|A \cap P| \leqslant 5$.

Actually, divide $P$ into 6 subsets: $\{1,5\}, \{2,9\}, \{3,7\}, \{4,8\}, \{6,10\}, \{11\}$. For each of these subsets, $A$ can contain at most one element, so $|A \cap P| \leqslant 6$. If $|A \cap P|=6$, then $A$ must contain at least one element from each of the divided subsets. Thus, $11 \in A \Rightarrow 4 \notin A \Rightarrow 8 \in A \Rightarrow 1 \notin A \Rightarrow 5 \in A \Rightarrow 9 \notin A \Rightarrow 2 \in A \Rightarrow 6 \notin A \Rightarrow 10 \in A \Rightarrow 3 \notin A \Rightarrow 7 \in A$, but $11-7=4$, which is a contradiction. Therefore, $|A \cap P| \leqslant 5$.
$$\text{Let } P_{k}=\{11 k+1,11 k+2, \cdots, 11 k+11\}(k=0,1,2, \cdots, 179),$$
$P_{180}=\{1981,1982, \cdots, 1989\}$. Then similarly, $A$ can contain at most 5 elements from each $P_{k}(k=0,1,2, \cdots, 180)$, so $|A| \leqslant 5 \times 181=905$.

Finally, let $A_{k}=\{11 k+1,11 k+3,11 k+4,11 k+6,11 k+9\}(k=0,1,2, \cdots, 180), A=A_{0} \cup A_{1} \cup \cdots \cup A_{180}$, then $A$ meets the requirements, and in this case, $|A|=905$. Therefore, the maximum value of $|A|$ is 905.