def main(): i = input() lst = i.split(' ') A,B,C,D=int(lst[0]),int(lst[1]),int(lst[2]),int(lst[3]) a = set([i for i in range(A,B+1)]) b = set([i for i in range(C,D+1)]) c = len(a)*len(b) print(c-len(a&b)) if __name__ == '__main__': main()