21 blocks. I did write the code to generate the list though.
Test cases: 1=>"I" 3=>"III" 4=>"IV" 24=>"XXIV" 501=>"DI" 999=>"CMXCIX" 1000=>"M"