from itertools import permutations N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 score = -10 for p in permutations(A): tot = 0 for x, y in zip(p, B): tot += max(0, x - y) if tot > score: score = tot ans = 1 elif tot == score: ans += 1 print(ans)