377. Difference Squares. Can you arrange 9 digits in a square so that in any row, any column, and on each of the main diagonals, the differences between the sum of two digits and the third digit are the same? In the square provided in our diagram, all rows and columns meet the required condition - the difference in them is 3 (for example, $4+2-3,1+9-7,6+5-8$, etc.), but the diagonals "fall short," since the differences $8-(4+1)$ and $6-(1+2)$ are obtained in a prohibited manner: one digit should not be subtracted from the sum of two others, but rather the sum of two minus one.

How many solutions exist in total?

| 4 | 3 | 2 |
| :--- | :--- | :--- |
| 7 | 1 | 9 |
| 6 | 5 | 8 |
377. Apparently, there are only three solutions provided here. In each case, the difference is 5.

OTBETM

277
![](https://cdn.mathpix.com/cropped/2024_05_21_56f37ca27ac3d928838dg-279.jpg?height=214&width=1310&top_left_y=338&top_left_x=382)