Implemented method to get total number of branches