<s>[INST] Number of possible matrices with the following property? I have a $8\times 8$ matrix, where every element of the matrix is either $0$, $1$ or $2$, so I define $A$ as a $8\times 8$ ternary matrix.
The matrix needs to have these properties:


*

*In the rows $1,2$ and $3$ the number $1$ must appear exactly once and no number $2$ can appear (per row).

*In the rows $4,5$ and $6$ the number $2$ must appear exactly once and no number $1$ can appear.

*In the rows $7$ and $8$ the numbers $1$ and $2$ must appear exactly once per row.

*All properties of the rows are held in the columns too.


An example would be
\begin{pmatrix}
1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 2 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 2 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 2 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 & 2 \\
0 & 0 & 0 & 0 & 0 & 0 & 2 & 1
\end{pmatrix}
How many matrices can we construct having these properties? What I find is that every configuration of an element is strongly connected to all the others, so I think the number cannot be very big.
 [/INST] Hint:
The top-left $3\times3$ minor is the identity or a permutation of the identity.
</s>