implemented torus neighbor count