Problem number 11850 solution