Count the total number of branches