output_description: Print the number of ID cards that allow us to pass all the gates alone.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N M
      L_1 R_1
      L_2 R_2
      \vdots
      L_M R_M
attempt: def main():
      from sys import stdin, stdout
  
      def read():
          return stdin.readline().rstrip("\n")
  
      def read_array(sep=None, maxsplit=-1):
          return read().split(sep, maxsplit)
  
      def read_int():
          return int(read())
  
      def read_int_array(sep=None, maxsplit=-1):
          return [int(a) for a in read_array(sep, maxsplit)]
  
      def write(*args, **kwargs):
          sep = kwargs.get("sep", " ")
          end = kwargs.get("end", "\n")
          stdout.write(sep.join(str(a) for a in args) + end)
  
      def write_array(array, **kwargs):
          sep = kwargs.get("sep", " ")
          end = kwargs.get("end", "\n")
          stdout.write(sep.join(str(a) for a in array) + end)
  
      n, m = read_int_array()
      l, r = 1, n
      for i in range(m):
          l1, r1 = read_int_array()
          l = max(l, l1)
          r = min(r, r1)
      write(max(r + 1 - l, 0))
  
  
  main()
  
problem_description: Statement
  
  We have N ID cards, and there are M gates.
  
  We can pass the i-th gate if we have one of the following ID cards: the L_i-
  th, (L_i+1)-th, ..., and R_i-th ID cards.
  
  How many of the ID cards allow us to pass all the gates alone?
samples: [{"input": "4 2\n    1 3\n    2 4", "output": "2\n    \n\nTwo ID cards allow us to pass all the gates alone, as follows:\n\n  * The first ID card does not allow us to pass the second gate.\n  * The second ID card allows us to pass all the gates.\n  * The third ID card allows us to pass all the gates.\n  * The fourth ID card does not allow us to pass the first gate.\n\n* * *"}, {"input": "10 3\n    3 6\n    5 7\n    6 9", "output": "1\n    \n\n* * *"}, {"input": "100000 1\n    1 100000", "output": "100000"}]