How to get number of posts in same category as current post?

I was finally able to get this to work using the following code:

global $wp_query;
$postcat = get_the_category( $post->ID );
$countposts = $postcat[0]->count;
$thiscat = get_category( get_query_var( 'cat' ) );
$postcount = $thiscat->count; 
return
is_single() && $countposts > 1 || is_category() && $postcount > 0;