This is a problem that I proposed for IMO 2011. It ended up in the IMO Shortlist, a set of 30 problems selected by the Problem Selection Committee from the 142 proposed problems from around the world. The IMO Jury then deliberated on the IMO Shortlist to select 6 problems for inclusion in the actual IMO paper (I was in the Jury too). Eventually the problem did not make it to the IMO, but I am proud of this nice little problem:
Source: IMO 2011 Shortlist.
Solution in this file: http://www.imo-official.org/problems/IMO2011SL.pdf