from itertools import * from collections import * N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans, maxv = 0, -1 D = defaultdict(int) for tup in permutations(A): v = 0 for i in range(N): v += max(0, tup[i] - B[i]) D[v] += 1 for k, v in D.items(): if k > maxv: ans = v maxv = k print(ans)