Thank you for reaching out.
As per the documentation here, the $top parameter is used to specify the page size of the result set. The minimum value of $top is 1 and the maximum depends on the corresponding API.
Also as per the query parameter limitation, when using the $count=true query string when querying against directory resources, the @odata.count property will be present only in the first page of the paged data. I think this explains not getting the desired result with $top=0.
Thanks!