As @shanebp suggests, you could use wp_count_terms()
like this:
$numTerms = wp_count_terms( 'service-category', array(
'hide_empty'=> false,
'parent' => 0
) );
The above will list All top parent terms, empty or not. This function uses get_terms()
functions arguments which can be found in the link or the arguments below:
$args = array(
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => true,
'exclude' => array(),
'exclude_tree' => array(),
'include' => array(),
'number' => '',
'fields' => 'all',
'slug' => '',
'parent' => '',
'hierarchical' => true,
'child_of' => 0,
'get' => '',
'name__like' => '',
'description__like' => '',
'pad_counts' => false,
'offset' => '',
'search' => '',
'cache_domain' => 'core'
);