This problem (judging by the search in Google) has already flashed many times in blogs and forums. But, for me, and I hope the majority of habra people - became a discovery ...
When they told me about it, I killed ten minutes to find an answer, and gave up ... When the veil of secrecy was ajar, the elegance of the solution put me in a stupor and made me laugh for a long time.
I remind you: the average preschooler solves it in 5 minutes.
PS I will ask you not to use cheating, such as Google, and not to post an answer prematurely, so as not to save other habra people from the pleasure ...