To get the pages to count you need to use
GET https://graph.microsoft.com/v1.0/me/onenote/pages?$count=true when you are using the above Graph API it's expecting page-id to get that page. Please refer to this documentation. To specify you are using a query parameter you need to use
?$count=true in this case.
$top=0 is giving you an error because as per the documentation the minimum value of $top is 1 and the maximum depends on the corresponding API.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.