from itertools import permutations def main(): N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) points = {} for p in permutations(a): point = 0 for x, y in zip(p, b): point += max(0, x-y) if point not in points: points[point] = 0 points[point] += 1 mkey = max(points.keys()) print(points[mkey]) main()