  We derive an efficient formula for Z$_2$ topological invariants
characterizing the quantum spin Hall effect. It is defined in a lattice
Brillouin zone, which enables us to implement numerical calculations for
realistic models even in three dimensions. Based on this, we study the quantum
spin Hall effect in Bi and Sb in quasi-two and three dimensions using a
tight-binding model.
