line = input().split(" ") min1 = int(line[0]) max1 = int(line[1]) min2 = int(line[2]) max2 = int(line[3]) list1 = list(range(min1, max1 + 1)) list2 = list(range(min2, max2 + 1)) cnt = 0 for num1 in list1: for num2 in list2: if (num1 != num2): cnt += 1 print(cnt)