Assume that $a_1\le\ldots\le a_n$. Suppose the contrary: $a_n>4a_1$.
Let $S$ be the sum
$$S=\sum_{1\le i<j\le n}\left(\frac{a_i}{a_j}+\frac{a_j}{a_i}\right)$$
Let's split this sum in three "parts" to bound them below:
The first, $S_1$ is just $a_1/a_n+a_n/a_1$.
$$S_1=\frac{a_1}{a_n}+\frac{a_n}{a_1}>4+\frac14=\frac{17}4$$
$S_2$ is the sum of the fractions where occurs $a_n$ or $a_1$, but not both:
$$\begin{align}
S_2&=\sum_{k=2}^{n-1}\left(\frac{a_k}{a_1}+\frac{a_k}{a_n}+\frac{a_1}{a_k}+\frac{a_n}{a_k}\right)\\
&=\left(1+\frac{a_1}{a_n}\right)\sum_{k=2}^{n-1}\left(\frac{a_k}{a_1}+\frac{a_n}{a_k}\right)\\
&\stackrel*\ge2(n-2)\left(1+\frac{a_1}{a_n}\right)\left(\frac{a_n}{a_1}\right)^{1/2}\\
&=2(n-2)\left[\left(\frac{a_n}{a_1}\right)^{1/2}+\left(\frac{a_1}{a_n}\right)^{1/2}\right]\\
&>\frac52\cdot 2(n-2)\ge 5(n-2)
\end{align}$$
Last, $S_3$ is the sum of the remaining terms:
$$S_3=\sum_{2\le i<j\le n-1}\left(\frac{a_i}{a_j}+\frac{a_j}{a_i}\right)\ge2\binom{n-2}2=n^2-5n+6$$
So
$$S>\frac{17}4+5n-10+n^2-5n+6=n^2+\frac14$$
and then
$$n+S>\left(n+\frac12\right)^2$$
Remarks: Throughout the proof I have been using two facts:
- The function $f(x)=x+x^{-1}$ for $x>1$ is strictly increasing.
- The sum of $r$ positive numbers whose product is $1$ is at least $r$. (This follows easily from AM-GM inequality).
For the inequality marked with $*$ I have used AM-GM inequality, too.