Four, (This question is worth 50 points) Let $a_{1}, a_{2}, \cdots, a_{20} \in\{1,2, \cdots, 5\}, b_{1}, b_{2}, \cdots, b_{20} \in\{1,2, \cdots, 10\}$, and the set $X=\left\{(i, j) \mid 1 \leq i<j \leq 20,\left(a_{i}-a_{j}\right)\left(b_{i}-b_{j}\right)<0\right\}$, find the maximum value of the number of elements in $X$.
Solution: Consider a set of positive integers $\left(a_{1}, a_{2}, \cdots, a_{20}, b_{1}, b_{2}, \cdots, b_{20}\right)$.
For $k=1,2, \cdots, 5$, let $t_{k}$ be the number of elements in $a_{1}, \cdots, a_{20}$ that take the value $k$. According to the definition of $X$, when $a_{k}=a_{j}$, $(i, j) \notin X$, so at least $\sum_{k=1}^{5} \mathrm{C}_{t_{k}}^{2}$ pairs $(i, j)$ are not in $X$. Note that $\sum_{k=1}^{5} t_{k}=20$, by the Cauchy-Schwarz inequality, we have
$$
\sum_{k=1}^{5} C_{t_{k}}^{2}=\frac{1}{2} \cdot\left(\sum_{k=1}^{5} t_{k}^{2}-\sum_{k=1}^{5} t_{k}\right) \geq \frac{1}{2} \cdot\left(\frac{1}{5}\left(\sum_{k=1}^{5} t_{k}\right)^{2}-\sum_{k=1}^{5} t_{k}\right)=\frac{1}{2} \cdot 20 \cdot\left(\frac{20}{5}-1\right)=30,
$$

Thus, the number of elements in $X$ is at most $\mathrm{C}_{20}^{2}-30=190-30=160$. 
On the other hand, take $a_{4 k-3}=a_{4 k-2}=a_{4 k-1}=a_{4 k}=k(k=1,2, \cdots, 5), b_{i}=6-a_{i}(i=1,2, \cdots, 20)$, then for any $i, j(1 \leq i<j \leq 20)$, we have
$$
\left(a_{i}-a_{j}\right)\left(b_{i}-b_{j}\right)=\left(a_{i}-a_{j}\right)\left(\left(6-a_{i}\right)-\left(6-a_{j}\right)\right)=-\left(a_{i}-a_{j}\right)^{2} \leq 0 .
$$

Equality holds if and only if $a_{i}=a_{j}$, which occurs exactly $5 C_{4}^{2}=30$ times. In this case, the number of elements in $X$ reaches $\mathrm{C}_{20}^{2}-30=160$.
In summary, the maximum number of elements in $X$ is 160.
50 points