import itertools N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) a = list(itertools.permutations(A)) b = list(itertools.permutations(B)) win_A = 0 win_B = 0 sum = 0 for s in a: for t in b: win_a = 0 win_b = 0 sum += 1 for i in range(N): if(s[i]>t[i]): win_a += 1 elif(s[i]win_b): win_A += 1 if(win_a