Just Stalling

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Farmer John has NN cows (1N201\le N \leq 20) of heights a_1a_Na\_1 \ldots a\_N. His barn has NN stalls with max height limits b_1b_Nb\_1 \ldots b\_N (so for example, if b_5=17b\_5 = 17, then a cow of height at most 1717 can reside in stall 55). 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 NN. The second line contains NN space-separated integers a_1,a_2,,a_Na\_1,a\_2,\ldots,a\_N. The third line contains NN space-separated integers b_1,b_2,,b_Nb\_1,b\_2,\ldots,b\_N. All heights and limits are in the range \[1,109]\[1,10^9].

출력

The number of ways Farmer John can place each cow into a different stall such that the height limit is satisfied for every stall. Note that the large size of the output might require the use of a 64-bit integer, like a "long long" in C++.