The *get command is the most powerful ANSYS APDL command!
Always look in the help (help,*get)!
You can get a lot (almost all) informations of ANSYS database with the *get command!
*get,n_num,node,,count !count of nodes
*get,n_max,node,,num,max !maximum node number (selected)
*get,n_maxd,node,,num,maxd !maximum node number (defined)