Troy is preparing for this year's CCO, which has
Unfortunately, Troy noticed that the shirts came in wrong! Although he received
Thankfully, Troy has a Very-Handy-Gadget. In one second, Troy can use his Very-Handy-Gadget to change either the size or the colour of any shirt.
Troy needs to distribute the shirts soon! How many seconds does he need so all participants get their required size and preferred colour?
Constraints
Input Specification
The first line contains two integers:
Then L
or S
, and the preferred colour
Then L
or S
, and the colour
Output Specification
Output a single integer, the minimum number of seconds Troy needs to give every participant the correct shirt, or
Sample Input 1
1 3
L 1
S 3
S 2
S 1
Output for Sample Input 1
1
Explanation for Sample Output 1
Troy should change the size of the
Sample Input 2
3 4
L 1
S 2
L 3
S 3
S 2
S 4
L 2
Output for Sample Input 2
2
Comments