This question is inspired from here, where it was asked what possible determinants an $n \times n$ matrix with entries in {0,1} can have over $\mathbb{R}$.

My question is: how many such matrices have non-zero determinant?

If we instead view the matrix as over $\mathbb{F}_2$ instead of $\mathbb{R}$, then the answer is

$(2^n-1)(2^n-2)(2^n-2^2) \dots (2^n-2^{n-1}).$

This formula generalizes to all finite fields $\mathbb{F}_q$, which leads us to the more general question of how many $n \times n$ matrices with entries in { $0, \dots, q-1$ } have non-zero determinant over $\mathbb{R}$?