We claim that the maximum possible value of $n$ is $\boxed{12}$.
Let pile $k$ include $1$ stone weighing $2k$, $k + 2004$ stones weighing $24$, and $13 - k$ stones weighing 25 for $k = 1, 2, \ldots 12$.
Now we will show that $n < 13$.
Let the initial total weights of the $n$ piles be $S_1 < S_2 < \ldots < S_n$. After the heaviest and lightest stones are removed, let the final total weights be $S_1' > S_2' > \ldots > S_n'$. Notice that $S_n - S_n' \geq (S_1 + n - 1) - (S_1' - (n - 1)) = S_1 - S_1' + 2(n - 1)$. The heaviest stone removed from the lightest pile must be at least the mean of the remaining $2016$ stones in the pile, and the lightest stone from that pile must weigh at least $1$. So $$S_1 - S_1' \geq \frac{S_1'}{2016} + 1.$$Also, the lightest stone from the heaviest pile must be at most the mean of the remaining $2016$ stones in the pile, and the heaviest stone from that pile must weigh at most $25$. So $$\frac{S_n'}{2016} + 25 \geq S_n - S_n' \geq S_1 - S_1' + 2(n - 1)$$and $$\frac{S_n' - S_1'}{2016} + 24 \geq 2(n - 1) \Rightarrow 2n - 2 < 24 \Leftrightarrow n < 13.$$