How many {habitat} are to/by {Earth} ?
What is the World's population?
How many people live on Earth?
SELECT ( COUNT ( ?y ) AS ?e ) { ?y property:habitat resource:Earth }
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/P2974> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q2 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P2974 wd:Q2 }
3