Bunch of problems like this are in the book "Problem-Solving Strategies" by Arthur Engel [1], I believe even including this particular one. Fun book.
[1]https://www.google.com/books/edition/Problem_Solving_Strateg...
[1]https://www.google.com/books/edition/Problem_Solving_Strateg...