Total IP's count

Hi all,
I want to get total number of ips in ip pool with a given name like: public-ip-pool in PHP.
I get used ips in php but i dont know how to get total ips with api.

I saw some methods using bash script with ssh but i dont understand it.

Get the ranges property and extrapolate from that, detect if its CIDR notation or x-y notation and then you can do the maths from then to figure out pool size.

isnt there a property/method where i get counts ?

Something like this
http://forum.mikrotik.com/t/ip-pool-statistics/36541/1