Set xm against the wall
S=x*(24-x)/2
=-(x^2)/2+ 12x
=-((x- 12)^2)/2+72
When the wall is 12m, the maximum area is 72m2.
So the maximum number of chickens is 72*2= 144.