method for counting branches