It's all about binary. First, put the IP addresses in binary notation, each part as a single byte
Code:
5.23.128.0 = 00000101 00010111 10000000 00000000
5.23.255.255 = 00000101 00010111 11111111 11111111
======== ======== =
Now, having both IPs in binary notation, you count the number of bits that are the same on both IPs, from left to right: 17. That's the CIDR mask, so your network is 5.23.128.0/17.
To get the number of IPs in such network, solve (2 ^ (32 - 17) ) - 1. Note that the number of usable IPs is two less than that.