The fence consists of $25$ vertical bars. The heights of the bars are pairwise distinct positive integers from $1$ to $25$. The width of every bar is $1$. Find the maximum $S$ for which regardless of the order of the bars one can find a rectangle of area $S$ formed by the fence.