Part of 2005 Finnish National High School Mathematics Competition
Source: Finnish Mathematics Competition 2005, Final Round, Problem 4