Write a program or function that accepts an integer in the range 1..3999 as input and returns the number of line segments required to express that integer in standard Roman numerals (so you would use XL but not VM). Examples:
1 -> 1
4 -> 3
5 -> 2
9 -> 3
10 -> 2
40 -> 4
50 -> 2
90 -> 3
100 -> 1
400 -> 3
500 -> 2
900 -> 5
1000 -> 4
Roman number conversion builtins are permitted, but you can solve the problem without them by repeatedly subtracting the largest remaining number from the above list. Example: 1234 = 4 + 1 + 1 + 2 + 2 + 2 + 3 = 15.
This is code-golf, so the shortest program wins.