The prime factorisation of 9 => 3^2
The number of perfect divisors of 9 = (2 + 1) - 2 = 1
Here, the first 2 is the exponent of 3 (the only prime in the factorisation of 9. The perfect divisors exclude 1 and 9 itself, so I subtracted 2 from the total number of divisors.
Similarly, the number of perfect divisors of 28 => 2^2 * 7 => (2 + 1)(1 + 1) - 2 = 4