Problem 27: solved with brute force