def main(): a,b,c,d=map(int,input().split()) l=[] cnt=0 for i in range(a,b+1): for j in range(c,d+1): cnt+=(i!=j) print(cnt) pass if __name__ == "__main__": main()