Fill an $n\times n$ matrix with numbers in $[1,n^2]$, where each number occurs exactly once.
For a fixed number filling method, let $a_i$ be the mininum number in the $i$th row, and $S=\{a_1,a_2,...,a_n\}\cap\{1,2,...,n\}$.
You need to calculate $\sum |S|\pmod {998244353}$, i.e. the sum of the size of $S$ over all possible methods.