Farmer John has n cows of heights a1,...,an. His barn has n stalls with max height limits b1,...,bn (so for example, if b5=17, then a cow of height at most 17 can reside in stall 5). In how many distinct ways can Farmer John arrange his cows so that each cow is in a different stall, and so that the height limit is satisfied for every stall?
The first line contains n(1≤n≤20). The second line contains n integers a1,a2,...,an. The third line contains n integers b1,b2,...,bn. All heights and limits are in the range [1,109].
Print the number of ways Farmer John can place each cow into a different stall such that the height limit is satisfied for every stall.
In this example, we cannot place the third cow into the first stall since 3=a3>b1=2. Similarly, we cannot place the fourth cow into the first or third stalls. One way to satisfy the height limits is to assign cow 1 to stall 1, cow 2 to stall 2, cow 3 to stall 3, and cow 4 to stall 4.