Their are two types of classifications . As you know class A class b c d e ... and another is classless .
the advantage of class less is we can distribute no. of ip according to their demands ( Should be power of 2 ) . according to you if /24 happens means the organization have to buy 2^8 means 256 ip but only 30 ip is needed .226-2 = 224 ip (one for netid and one for broadcast add which we cant use as host id ) will be unused , for that reason classless comes in to the picture , /5 for this organization buys only 32 ip , see the wastage is reduced . so the mask will be 11111111.11111111.11111111.11100000