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