Part of 2010 Middle European Mathematical Olympiad
Source: (4th Middle European Mathematical Olympiad, Individual Competition, Problem 1)