A, B, C, D = map(int, input().split()) ans = 0 for i in range(1, 101): for j in range(1, 101): if not A <= i <= B: continue if not C <= j <= D: continue if i == j: continue ans += 1 print(ans)