Let n be the number of chickens and let d be the number of days in which Mohammed will run out of chicken-food with this number of chickens. The total amount of chicken-food always equals the number of chickens multiplied by the number of days the food lasts. Therefore, the total amount of chicken-food equals n × d.

If Mohammed would sell 75 of his chickens, he could feed the remaining chickens twenty days longer, so the total amount of chicken-food would then equal

( n - 75 ) × ( d + 20 ).

But the total amount of chicken-food does not change, so

( n - 75 ) × ( d + 20 ) = n × d

which can be rewritten to equation 1:

d = 4/15 × n - 20.

If Mohammed would buy 100 extra chickens, he would run out of chicken-food fifteen days earlier, so the total amount of chicken-food would then equal

( n + 100 ) × ( d - 15 ).

But the total amount of chicken-food does not change, so

( n + 100 ) × ( d - 15 ) = n × d

which can be rewritten to equation 2:

d = 3/20 × n + 15.

Combining equations 1 and 2 gives:

4/15 × n - 20 = 3/20 × n + 15.

Solving this equations gives n = 300, so farmer Mohammed has 300 chickens.