A, B, C, D = map(int, input().split(' ')) reds = {i for i in range(A, B + 1)} blacks = {i for i in range(C, D + 1)} all_pairs_num = len(reds) * len(blacks) commons = reds & blacks print(all_pairs_num - len(commons))