The area of the sqare is side x side.
We use the area cause there were also men inside the sqare, not only on the edges.
side^2+9 (the left over)=335250
side=sqare root 335241
so there were 579 rows with 579 soldiers on each row (cause it's a sqare)