Count rings in the network.