A, B, C, D = map(int, input().split()) p = [1 for x in range(A, B+1) for y in range(C, D+1) if x != y] print(len(p))