How many accounts does my Nextcloud have? occ answers that in one line.
sudo -E -u www-data php occ user:report
The docs show a table like this one:
| Database | 12 |
| LDAP | 86 |
| total users | 98 |
| user directories | 2 |
| active users | 15 |
| disabled users | 0 |
The first rows are the user backends, so a server that mixes local accounts with LDAP shows both. That makes it a quick check after you connect a directory, to see whether the expected number of people came through.
The caveat is in how the docs define the numbers. Active users are accounts that logged in at least once. Someone who was created but never logged in counts as neither active nor disabled. Some backends cannot count their users and may show zero, so a zero is not proof of an empty directory.
For a home server with a handful of accounts it is a curiosity. Together with occ user:lastseen --all it tells you how much of your user list is real use.
Further reading: Nextcloud admin manual: user and group commands
Going deeper: Guide: put Nextcloud behind Nginx Proxy Manager with HTTPS and the right headers