4. Several different numbers are written on the blackboard, such that the sum of any three of them is a rational number, while the sum of any two is an irrational number. The maximum number of numbers that can be written on the blackboard is $\qquad$
4. 3 .

Assume that the numbers written on the blackboard are no less than four, denoted as $a, b, c, d$. Then, $a+b+c$ and $b+c+d$ are both rational numbers, which implies that their difference
$$
(b+c+d)-(a+b+c)=d-a
$$
is also a rational number.
Similarly, $b-a$ and $c-a$ are also rational numbers.
Therefore, $b=a+r_{1}, c=a+r_{2}, d=a+r_{3}$, where $r_{1}, r_{2}, r_{3}$ are rational numbers.

Furthermore, since $a+b+c=3a+r_{1}+r_{2}$ is a rational number, it follows that $a$ is also a rational number. This indicates that $a+b=2a+r_{1}$ is a rational number, which contradicts the condition that "the sum of any two is irrational."

Therefore, the numbers written on the blackboard do not exceed three, such as $\sqrt{2}$, $2\sqrt{2}$, and $-3\sqrt{2}$.