N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) ans = 0 l = 0 for r in range(1, N): if(A[r] - A[r-1] > abs(B[r] - B[r-1])): ans += r - l else: l = r print(ans)