Part of 2010 Canadian Mathematical Olympiad Qualification Repechage
Source: Canadian Repêchage 2010: Problem 4