Example 8 Given a prime number $p$. Let $A=\left(a_{i j}\right)$ be a $p \times p$ matrix, satisfying
$$
\left\{a_{i j} \mid 1 \leqslant i, j \leqslant p\right\}=\left\{1,2, \cdots, p^{2}\right\} .
$$

We are allowed to perform the following operation on a matrix: first select a row or a column, and then add 1 or subtract 1 from each number in that row or column. If we can transform all elements of matrix $A$ to 0 through a finite number of the above operations, then $A$ is called a "good matrix". Find the number of good matrices $A$. ${ }^{[4]}$
【Analysis】If $A$ is a good matrix, then after a finite number of operations, matrix $A$ can be transformed into a "zero matrix". Suppose all operations to transform matrix $A$ into a "zero matrix" involve subtracting $x_{i}$ from each number in the $i$-th row and subtracting $y_{j}$ from each number in the $j$-th column $(1 \leqslant i, j \leqslant p)$.
Then $a_{i j}=x_{i}+y_{j}$.
Given that all numbers in matrix $A$ are distinct, it follows that $x_{1}, x_{2}, \cdots, x_{p}$ are distinct, and $y_{1}, y_{2}, \cdots, y_{p}$ are also distinct (otherwise, if $x_{1}=x_{2}$, then $a_{11}=x_{1}+y_{1}=x_{2}+y_{1}=a_{21}$, which is a contradiction).

Furthermore, by the problem statement, swapping any two rows or two columns does not change whether a matrix is a good matrix. Therefore, we can assume without loss of generality that
$x_{1}<x_{2}<\cdots<x_{p}$, and $y_{1}<y_{2}<\cdots<y_{p}$.
Thus, we assume that each row of matrix $A$ is increasing from left to right, and each column is increasing from top to bottom.
Therefore, $a_{11}=1, a_{12}=2$ or $a_{21}=2$.
Assume $a_{12}=2$ (otherwise, reflecting the entire matrix about the main diagonal does not change that $A$ is a good matrix).
We now prove that $1, 2, \cdots, p$ are all in the first row.
Assume $1, 2, \cdots, k(2 \leqslant k<p)$ are in the first row, but $k+1$ is not in the first row.
Thus, $a_{21}=k+1$.
We call a sequence of $k$ consecutive integers a "block". We need to prove that the first row consists of several blocks, i.e., the first $k$ numbers form a block, the next $k$ numbers form another block, and so on. Otherwise, suppose the first $n$ groups of $k$ numbers are blocks, but the next $k$ numbers are not a block. Therefore, $y_{(j-1) k+1}, y_{(j-1) k+2}, \cdots, y_{j k}$ $(j=1,2, \cdots, n)$ all form blocks.

Thus, the first $n k$ columns of the matrix can be divided into $p n$ sub-matrices of size $1 \times k$: $a_{i,(j-1) k+1}, a_{i,(j-1) k+2}, \cdots, a_{i, j k}$ $(i=1,2, \cdots, p ; j=1,2, \cdots, n)$, with each sub-matrix containing $k$ numbers that form a block.

Now assume $a_{1, n k+1}=a$. Let $b$ be the smallest positive integer such that $a+b$ is not in the first row, then $b \leqslant k-1$.
Since $a_{2, n k+1}-a_{1, n k+1}=x_{2}-x_{1}$
$=a_{21}-a_{11}=k$,
then $a_{2, n k+1}=a+k$.
Thus, $a+b$ must be in the first $n k$ columns, and therefore, $a+b$ is contained in one of the previously mentioned $1 \times k$ blocks, but $a$ and $a+k$ are not in that block, which is a contradiction.
Hence, the first row consists of several blocks. Therefore, $k \mid p$.
But $1<k<p$, which contradicts the fact that $p$ is a prime number.
Thus, the first row of the matrix is exactly $1, 2, \cdots, p$, and the $k$-th row must be $(k-1) p+1, (k-1) p+2, \cdots, k p$.

In summary, the essential characteristic of a good matrix $A$ is that it can always be transformed into a unique form by swapping rows, swapping columns, and reflecting about the main diagonal.
Therefore, the number of good matrices is $2(p!)^{2}$.