abcd=[int(i) for i in input().split()] rb=[[i,j] for i in range(abcd[0],abcd[1]+1) for j in range(abcd[2],abcd[3]+1) if i!=j] print(len(rb))