  Let $f(x)\in\mathbb{Z}[x]$ be a nonconstant polynomial. Let $n, k$ and $c$ be
integers such that $n\ge 1$ and $k\ge 2$. An integer $a$ is called an
$f$-exunit in the ring $\mathbb{Z}_n$ of residue classes modulo $n$ if
$\gcd(f(a),n)=1$. In this paper, we use the principle of cross-classification
to derive an explicit formula for the number ${\mathcal N}_{k,f,c}(n)$ of
solutions $(x_1,...,x_k)$ of the congruence $x_1+...+x_k\equiv c\pmod n$ with
all $x_i$ being $f$-exunits in the ring $\mathbb{Z}_n$. This extends a recent
result of Anand {\it et al.} [On a question of $f$-exunits in
$\mathbb{Z}/{n\mathbb{Z}}$, {\it Arch. Math. (Basel)} {\bf 116} (2021),
403-409]. We derive a more explicit formula for ${\mathcal N}_{k,f,c}(n)$ when
$f(x)$ is linear or quadratic.
