from itertools import permutations N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) P = [i for i in range(N)] maxpoint = 0 maxcount = 0 for p in permutations(P): point = 0 j = 0 for i in p: point += max(0, A[i] - B[j]) j += 1 if point > maxpoint: maxpoint = point maxcount = 1 elif point == maxpoint: maxcount += 1 print(maxcount)