4. The number of right-angled triangles with integer side lengths and area (numerically) equal to the perimeter is $\qquad$
4.2.

Let the legs of a right-angled triangle be $a, b$, and $c = \sqrt{a^{2}+b^{2}} (a \leqslant b)$, then we have
$$
\frac{1}{2} a b = a + b + \sqrt{a^{2} + b^{2}}.
$$

Thus, $\frac{1}{2} a b - a - b = \sqrt{a^{2} + b^{2}}$.
Squaring both sides and simplifying, we get
$$
a b - 4 a - 4 b + 8 = 0.
$$

Then, $(a-4)(b-4) = 8$.
Since $a, b$ are positive integers, when $a = 5$, $b = 12$; when $a = 6$, $b = 8$.
Therefore, there are 2 triangles that satisfy the problem.