In Wen's Quantum Field theory of many body systems, on page 254, it discusses Z2 gauge theory, and states that
Count the number of states in the Z2 gauge theory on a finite square lattice. We assume that the lattice has a periodic boundary condition in both directions (i.e the lattice forms a torus). If the lattice has $N_{site}$ sites, then it has $2N_{site}$ nearest neighbor links.
This is very confusing. If I take a square lattice, I see that each point has two nearest neighbors. However, if I extend the lattice into a 3rd dimension, I would also expect nearest neighbors behind and after the lattice "slice", giving me 4N nearest neighbors. I was told that it has to do with combinatorics and the prefactor for feynman diagrams, but I'm wondering if there isn't a simpler explanation. And if there isn't, where can I learn this type of information?
Any help greatly appreciated!