A clever farmer wins the hand of a princess when he uses a counting activity to make the watchful king fall asleep.