The product rule
[Polygons and polyhedra with vertices at lattice nodes]

On a sheet of paper, a grid of $n$ horizontal and $n$ vertical lines is drawn. How many different closed $2 n$-segment broken lines can be drawn along the grid lines such that each broken line passes through all horizontal and all vertical lines?
Let's define a direction of traversal for each such broken line. It is clear that if we count the number of broken lines oriented in this way, we will count each unoriented broken line twice. For each oriented broken line, we will number its sides in the direction of traversal, starting with the side lying on the far left vertical line. Thus, each oriented broken line is uniquely determined by specifying the order in which it passes through the $n$ horizontal lines and the remaining $n-1$ vertical lines. Therefore, the number of oriented broken lines is $n!(n-1)!$, and the number of unoriented broken lines is half of that.

## Answer

$1 / 2 n!(n-1)!$