IMO 1986 LL HUN42

The integers 1, 2, . . ., n2 are placed on the fields of an n imes n

IMO 1986 LL HUN42

Origin: HUN

Problem

The integers 1, 2, . . ., n2 are placed on the fields of an n \times n chessboard (n > 2) in such a way that any two fields that have a common edge or a vertex are assigned numbers differing by at most n + 1. What is the total number of such placements?