output_description: Print the length of the duration (in seconds) in which both Alice and Bob were
  holding down their buttons.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      A B C D
attempt: # region header
  import sys
  import math
  from bisect import bisect_left, bisect_right, insort_left, insort_right
  from collections import defaultdict, deque, Counter
  from copy import deepcopy
  from fractions import gcd
  from functools import lru_cache, reduce
  from heapq import heappop, heappush
  from itertools import (
      accumulate,
      groupby,
      product,
      permutations,
      combinations,
      combinations_with_replacement,
  )
  from math import ceil, floor, factorial, log, sqrt, sin, cos
  from operator import itemgetter
  from string import ascii_lowercase, ascii_uppercase, digits
  
  sys.setrecursionlimit(10**7)
  rs = lambda: sys.stdin.readline().rstrip()
  ri = lambda: int(rs())
  rf = lambda: float(rs())
  rs_ = lambda: [_ for _ in rs().split()]
  ri_ = lambda: [int(_) for _ in rs().split()]
  rf_ = lambda: [float(_) for _ in rs().split()]
  INF = float("inf")
  MOD = 10**9 + 7
  # endregion
  A, B, C, D = ri_()
  print(min(B, D) - max(A, C))
  
problem_description: Statement
  
  Alice and Bob are controlling a robot. They each have one switch that controls
  the robot.  
  Alice started holding down her button A second after the start-up of the
  robot, and released her button B second after the start-up.  
  Bob started holding down his button C second after the start-up, and released
  his button D second after the start-up.  
  For how many seconds both Alice and Bob were holding down their buttons?
samples: [{"input": "0 75 25 100", "output": "50\n    \n\nAlice started holding down her button 0 second after the start-up of the\nrobot, and released her button 75 second after the start-up.  \nBob started holding down his button 25 second after the start-up, and released\nhis button 100 second after the start-up.  \nTherefore, the time when both of them were holding down their buttons, is the\n50 seconds from 25 seconds after the start-up to 75 seconds after the start-\nup.\n\n* * *"}, {"input": "0 33 66 99", "output": "0\n    \n\nAlice and Bob were not holding their buttons at the same time, so the answer\nis zero seconds.\n\n* * *"}, {"input": "10 90 20 80", "output": "60"}]