a, b, c, d = map(int, input().split()) cnt = 0 for red in range(a, b+1): for black in range(c, d+1): if red != black: cnt +=1 print(cnt)