Part of 2017 Regional Competition For Advanced Students
Source: Austrian Mathematics Olympiad Regional Competition (Qualifying Round) 2017, Problem 4