For $n$ positive integers $a_1,...,a_n$ consider all their pairwise products $a_ia_j$, $1 \le i < j \le n$. Let $N$ be the number of those products which are the cubes of positive integers.
Find the maximal possible value of $N$ if it is known that none of $a_j$ is a cube of an integer.

(S. Mazanik)