Leo's attempt at Problem 4, using Somesh's hints