
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Given a prime number \( \mathrm{p} \), let \( A = \left(a_{ij}\right) \) be a \( p \times p \) matrix that satisfies
$$
\left\{\mathrm{a}_{\mathrm{ij}} \mid 1 \leq \mathrm{i}, \quad \mathrm{j} \leq \mathrm{p}\right\}=\left\{1,2, \ldots, \mathrm{p}^{2}\right\}
$$

We are allowed to perform the following operation on the matrix: select a row or a column, and simultaneously add or subtract 1 from each number in that row or column. If it is possible to transform all elements in \( \mathrm{A} \) to 0 through a finite number of such operations, then \( \mathrm{A} \) is called a "good matrix". Find the number of good matrices \( A \).

Present the answer in LaTex format: \boxed{Your answer}
user