The "len" function returns the number of characters in a text string.
So suppose you had the names in cells A1 to A50.
In cell B1, put =len(A1).
Copy/paste that down the B column.
Then use =countif(B1:B50,"<5") in the next cell.
Or did you want <= 5, I forget. If you wanted that, use <= 5 (or < 6).