Congruence condition relating number of subrings in maximal subrings and number of subrings in the whole ring

Statement
Suppose $$L$$ is a fact about::nilpotent ring whose order (i.e., the size of its underlying set) is a prime power $$p^k$$. Suppose $$\mathcal{S}$$ is a collection of subrings of $$L$$. For a subring $$S$$ of $$L$$, denote by $$n(S)$$ the number of subrings of $$S$$ that are in $$\mathcal{S}$$.

If $$L \notin \mathcal{S}$$, we have:

$$\! n(L) \equiv \sum_{M \operatorname{max} L} n(M) \pmod p$$

Here, the summation is over all maximal subrings of $$L$$.

If $$L \in \mathcal{S}$$, we get:

$$\! n(L) \equiv 1 + \sum_{M \operatorname{max} L} n(M) \pmod p$$

Related facts

 * Congruence condition relating number of subgroups in maximal subgroups and number of subgroups in the whole group