Part of 2015 Federal Competition For Advanced Students, P2
Source: 46th Austrian Mathematical Olympiad National Competition Part 2 Problem 4