  In layered magnetic materials, the magnetic coupling between neighboring van
der Waals layers is challenging to understand and anticipate, although the
exchange interaction inside a layer can be well rationalized for example by the
superexchange mechanism. In this work, we elucidate the interlayer exchange
mechanism and propose an electron-counting rule to determine the interlayer
magnetic order between van der Waals layers, based on counting the $d$-orbital
occupation ($d^n$, where $n$ is the number of $d$-electrons at the magnetic
cation). With this rule, we classify magnetic monolayers into two groups,
type-I ($n<5$) and type-II ($n\geq5$), and derive three types of interlayer
magnetic coupling for both insulators and metals. The coupling between two
type-II layers prefers the antiferromagnetic (AFM) order, while type-I and
type-II interfaces favor the ferromagnetic (FM) way. However, for two type-I
layers, they display competition between FM and AFM orders and even lead to the
stacking dependent magnetism. Additionally, metallic layers can also be
incorporated into this rule with a minor correction from the free carrier
hopping. Therefore, this rule provides simple guidance to understand the
interlayer exchange and further design van der Waals junctions with desired
magnetic orders.
