Forum:Returning the ACTUAL number of pages in a category

How can I return the ACTUAL number of pages in a category? Using the  template returns the number of pages AND the number of sub-categories in a category. E.g: this template uses the code  and returns (currently) 121. But the actual category has 105 pages and 16 sub-categories.

Any ideas how to exclude the sub-categories without just using  as this will not be true once new sub-categories are added. Thanks OllieMartin 11:04, September 12, 2010 (UTC)
 * The problem is, MediaWiki considers a sub-cat a page, and thus a member of the category -- Random Time  11:30, September 12, 2010 (UTC)


 * So is there any code to return the count of a particular name space within a category so we can take that figure from the total? OllieMartin 11:55, September 12, 2010 (UTC)


 * If you have the Semantic MediaWiki extension enabled,  should return the number of main namespace pages in the category.  14:53, September 12, 2010 (UTC)


 * Okay, sounds interesting. So how do I have the Semantic MediaWiki extension enabled? OllieMartin 15:54, September 13, 2010 (UTC)