from itertools import permutations n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) dic = {} for x in permutations(A): t = 0 for i in range(n): if x[i] > B[i]: t += abs(x[i] - B[i]) dic.setdefault(t, 0) dic[t] += 1 print(dic[max(dic)])