<s>[INST] How many solutions to the diophantine equation: $a + b + c + d = 22$
where
$\{a,b,c,d\}$ are distinct integers,
and
for each $x \in \{a,b,c,d\}, 1 \le x \le 9$.
Is there an elegant solution?
 [/INST] Count only the cases with  $a<b<c<d$ and multiply with $4!=24$ afterwards.
Necessarily, $d\ge 7$, as otherwise $a+b+c+d\le 3+4+5+6=18<22$.
If $d=7$, then necessarily $a=4, b=5, c=6$, which gives us one solution $(4,5,6,7)$.
If $d=8$, we have the solution $(3,5,6,8)$, by increasing $c$ $(2,5,7,8)$ and $(3,4,7,8)$.
If $d=9$, there are again few enough  solutions to count "by hand": $(1,4,8,9)$, $(2,3,8,9)$, $(1,5,7,9)$, $(2,4,7,9)$, $(2,5,6,9)$, $(3,4,6,9)$.
So the grand total is $240$.
</s>