different answer for different sql versions.
SQL 2005 and 2008 gives 21 while 2000 with nvarchar(8000) throws error
Msg 2717, Level 16, State 2, Line 1
The size (8000) given to the parameter '@String' exceeds the maximum allowed (4000).
Parameter '@String' has an invalid data type.
giving varchar(8000) would give 20 answer.
20 (9), (10), (11), (12), (13), $(36), +(43), ,(44), -(45), .(46), 0(48), 1(49), 2(50), 3(51), 4(52), 5(53), 6(54), 7(55), 8(56), 9(57),
Thanks for a good question.
SQL DBA.