first = input().split() A = int(first[0]) B = int(first[1]) C = int(first[2]) D = int(first[3]) AB = range(A,B+1) CD = range(C,D+1) double = set(AB)&set(CD) countdouble = len(double) countAB = len(AB) countCD = len(CD) ans = countAB*countCD - countdouble print(ans)