2018 IMO Problems/Problem 2

Find all numbers $n \ge 3$ for which there exists real numbers $a_1, a_2, ..., a_{n+2}$ satisfying $a_{n+1} = a_1, a_{n+2} = a_2$ and \[a_{i}a_{i+1} + 1 = a_{i+2}\] for $i = 1, 2, ..., n.$

Invalid username
Login to AoPS