You can only know the total number of users on a channel when you receive RAW 366, you can start checking for number of users when you receive RAW 353, but if it's a large channel, the server can send you multiple RAW 353s.
raw 353:*:echo -t $3 * $nick($3,0) users counted on $3 so far!
raw 366:*:echo -t $2 * Total of $nick($2,0) users on $2 $+ !
In other words: you can't know the number of users on the channel on join. Only after you receive the names.