Post Count Outside the loop

global $wp_query;
$getcount=$wp_query->found_posts;

echo $getcount;