You need to calculate A048291(n).
Let $|A|$ be how many rows we insist on being full, $|B|$ be how many columns we insist on being full, there are $\big( n^2 \;-\;n\,|A|\;-\;n\,|B|\;+\;|A|\,|B| \big)$ cells we don't care they are full or empty.
Using inclusion-exclusion rule,
$$
\begin{aligned} A048291(n)
&= 2^{n^2} - \sum_{\substack{A\subseteq\{1,\dots,n\}\\B\subseteq\{1,\dots,n\}\\(A,B)\neq(\emptyset,\emptyset)}} (-1)^{|A|+|B|+1}\, 2^{\;n^2 \;-\;n\,|A|\;-\;n\,|B|\;+\;|A|\,|B|}\,
\\ &=\; \; \sum_{i=0}^{n} \sum_{j=0}^{n} (-1)^{(i+j)}\tbinom{n}{i}\tbinom{n}{j}2^{(ij)}
\end{aligned}
$$
The formula here is consistent with the formula of Mathematica code in the OEIS A048291 page.
Flatten[{1, Table[Sum[Binomial[n, k]*(-1)^k*(2^(n-k)-1)^n, {k, 0, n}], {n, 1, 15}]}]
Flatten[{1, Table[Sum[(-1)^(i + j)*Binomial[n, i]* Binomial[n, j]*2^(n*n - (i*n + j*n - i*j)), {i, 0, n}, {j, 0, n}], {n, 1, 15}]}]
Flatten[{1, Table[2^(n*n) - Sum[Boole[Not[i == 0 && j == 0]]*(-1)^(i + j + 1)*Binomial[n, i]* Binomial[n, j]*2^(n*n - i*n - j*n + i*j), {i, 0, n}, {j, 0, n}], {n, 1, 15}]}]