import numpy as np N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = [0] * len(A) for b in B: D = [i for i, x in enumerate(A) \ if x == min(A)] C_ = [C[x] for x in D] T = [x for x in D if C[x] == min(C_) and A[x] == min(A)] idx = T[0] A[idx] += (b//2) C[idx] += 1 print(max(C))