Determine all positive integers $n$ for which there exist pairwise distinct positive real numbers $a_1, a_2, \cdots, a_n$ satisfying $\displaystyle \left\{a_i+\frac{(-1)^i}{a_i}\mid 1\leq i \leq n\right\}=\{a_i\mid 1\leq i \leq n\}$
Source: Hong Kong TST 4 Problem 2
Tags: algebra
Determine all positive integers $n$ for which there exist pairwise distinct positive real numbers $a_1, a_2, \cdots, a_n$ satisfying $\displaystyle \left\{a_i+\frac{(-1)^i}{a_i}\mid 1\leq i \leq n\right\}=\{a_i\mid 1\leq i \leq n\}$