As each number of the grid appears exactly once in the sum of all columns of the grid and the same holds for the sum of all rows, we get that S is twice the sum of all labels of the boxes of the n×n grid. Therefore, S=0 holds if and only if the sum of all labels of the boxes vanishes, or equivalently, if the number of labels +1 equals the number of labels −1. We call such a labelling admissible.
a. If n is odd, the sum of all labels is also odd, because it is a sum of an odd number of odd labels. Thus there cannot be an admissible labelling in this case.
b. If n is even, we write n=2k for some integer k. The admissible labellings can be constructed as follows: Choose exactly half of the n2=4k2 boxes arbitrarily and label each of them with +1. The remaining boxes are labelled with −1.
Thus there are exactly ak:=(2k24k2) admissible labellings of a 2k×2k grid.
We have a1=(24)=6 and it is easily seen that ak is increasing in k: if 1≤k′<k, each admissible labelling of any 2k′×2k′ subgrid can be extended to an admissible labelling of the 2k×2k grid by choosing half of the extra 4k2−4k′2 boxes and labelling each of them with +1 and the remaining boxes with −1. Therefore, ak≥6 for all k.