counting unreachable nodes