from itertools import permutations ans = 0 n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) maxvalue = 0 for v in permutations(a): submax = 0 for i in range(n): submax += max(0, v[i] - b[i]) if submax > maxvalue: ans = 1 maxvalue = submax elif submax == maxvalue: ans += 1 print(ans)