How many {occupation} are to/by {Shah} ?
Shah contains how many occupants?
How many occupants are there with {Shah} ?
SELECT ( COUNT ( ?q ) AS ?j ) { ?q property:occupation resource:Shah }
SELECT (COUNT(?sub) AS ?subs ) {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?sub .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P106> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q184299 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P106 wd:Q184299 }
5