You are given an grid. Each cell initially contains some number of stones, such that the total number of stones is exactly .
In one move, you may take a single stone and move it to any other cell in the same row or the same column.
Your goal is to minimize the number of moves needed to make each cell contain exactly one stone.