Master and Challenge

0

0 votes
Very-Easy
Problem

Master has challenged the Doctor for a game. Rules of this game are simple: each player bring his favourite n-digit number. Then both players name the digits of their numbers one by one. If two digits are not equal, then the player, whose digit is smaller gets a flick (knock in the forehead usually made with a forefinger) from the other player. For example, if n = 3, Doctor's number is 123 and Master has number 321, first Doctor names 1 and Master names 3 so Doctor gets a flick. Then they both name digit 2 so no one gets a flick. Finally, Doctor names 3, while Master names 1 and gets a flick.

Of course, Doctor will play honestly naming digits one by one in the order they are given, while Master, being his archenemy, plans to cheat. He is going to name his digits in some other order (however, he is not going to change the overall number of occurences of each digit). For example, in case above Master could name 1, 2, 3 and get no flicks at all, or he can name 2, 3 and 1 to give Doctor two flicks.

Your goal is to find out the minimum possible number of flicks Master will get (no one likes flicks) and the maximum possible number of flicks Doctor can get from Master. Note, that these two goals are different and the optimal result may be obtained by using different strategies.

Input Format:

First line consists of the number N.

Second line consists of Doctor's N-digit number.

Third line consists of Master's N-digit number.

Output Format:

First print the minimum possible number of flicks Master will get.

Then print the maximum possible number of flicks that Doctor can get from Master.

Constraints:

1N1000

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Sample is elaborated in the problem statement.

Editor Image

?