Problem

Source: Izho 2020 problem 6

Tags: combinatorics, IZHO 2020



Some squares of a $n \times n$ tabel ($n>2$) are black, the rest are withe. In every white square we write the number of all the black squares having at least one common vertex with it. Find the maximum possible sum of all these numbers.