Let $A$ be an $n\times n$ matrix with integer entries and let $d_1,...,d_n|q$ all be given natural numbers (I am happy to assume that $q$ is a prime power).
How many solutions $x_1,...,x_n$ modulo $q$ does
\[ A\mathbf x\equiv \mathbf 0\hspace {5mm}\text {mod}\hspace {1mm}(\mathbf d)\]
have?
(Motivation/context: This comes up in the local factors in a circle method application.)