# -*- coding: utf-8 -*- a,b,c,d = map(int,input().split()) ans = (b-a+1)*(d-c+1) if d < a or b < c: pass elif a < c and d < b: ans -= d-c+1 elif c < a and b < d: ans -= b-a+1 else: ans -= min(b-c+1,d-a+1) print(ans)