a,b,c,d=list(map(int,input().split())) hoge1,hoge2=[i for i in range(a,b+1)],[i for i in range(c,d+1)] hoge3=list() for e1 in hoge1: for e2 in hoge2: if e1!=e2: hoge3.append([e1,e2]) print(len(hoge3))