In every cell of the table either or is written. Then the sums of the numbers for every row and column are calculated. What is the maximum amount of different values that can be among these numbers?

In every cell of the table either or is written. Then the sums of the numbers for every row and column are calculated. What is the maximum amount of different values that can be among these numbers?

The sums vary from to , thus there exist different values for the sum. Let us show that all values cannot be present simultaneously. Let us suppose that there is a row or a column with the sum , thus all the cells of that row or column are zeroes. If it is a column, then the maximum value for the row is . If it is a row, then in columns can be only values from to . But then there can be more different values in rows. Together we have not more than different values. Example is shown on the picture (Fig. 20).