You have $50$ baskets, and each basket contains between $1$ and $24$ apples. I assume no basket contains $0$ apples since you said "$50$ baskets containing apples". Then you can take out 48 baskets and place $1$ apple in two of them, $2$ apples in two of them etc. until you have 48 baskets and for every number between $1$ and $24$ there are exactly two baskets containing that many apples. Now you have $2$ empty baskets left. Regardless of how many apples you place in them, there are two baskets already containing equally many apples. So you will at least $3$ baskets containing equally many apples.
Edit: I hope this helps you in thinking about the PHP in a more intuitive way, rather than simply looking at formulas. When considering these "basic" PHP problems I like to carry out the argument as I did above, at least in my mind before I write down my answer using the PHP results, because it's a very logical and simple reasoning, so less room for mistakes.
2nd Edit: Maybe you can try to reason why there are at most two cases of "$3$ baskets containing equally many apples". That is, if there are $3$ baskets containing $a_1$ apples, and there are $3$ other baskets containing $a_2$ apples, then you cannot have a third set of $3$ baskets containing equally many apples. Begin with the two remaining baskets in my explanation above, and see what happens when you fill the last two.