query: PREFIX wikibase: <http://wikiba.se/ontology#>
  PREFIX wd: <http://www.wikidata.org/entity/> 
  PREFIX wdt: <http://www.wikidata.org/prop/direct/>
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  
   SELECT ?nationality (COUNT(?person) AS ?count) 
  		WHERE {
     	      ?person wdt:P31 wd:Q5 .
            ?person wdt:P27 ?nationality .
            OPTIONAL {?person wdt:P21 ?gender} .
            FILTER (!bound(?gender)) .
          }
  	    GROUP BY ?nationality
          ORDER BY DESC(?count) 
          LIMIT 40
  
  