output_description: Print the minimum number of bridges that must be removed.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N M
      a_1 b_1
      a_2 b_2
      :
      a_M b_M
attempt: n, m = map(int, input().split())
  ab = [list(map(int, input().split())) for _ in [0] * m]
  hm = {}
  for a, b in ab:
      if (b - a) in hm.keys():
          hm[b - a] += [(a, b)]
      else:
          hm[b - a] = [(a, b)]
  hmk = sorted(hm.keys())
  l = [False] * n
  for k in hmk:
      c = hm[k]
      if k == 1:
          for a, _ in c:
              l[a] = True
      else:
          for a, b in c:
              if True in l[a:b]:
                  pass
              else:
                  l[b - 1] = True
  print(l.count(True))
  
problem_description: Statement
  
  There are N islands lining up from west to east, connected by N-1 bridges.
  
  The i-th bridge connects the i-th island from the west and the (i+1)-th island
  from the west.
  
  One day, disputes took place between some islands, and there were M requests
  from the inhabitants of the islands:
  
  Request i: A dispute took place between the a_i-th island from the west and
  the b_i-th island from the west. Please make traveling between these islands
  with bridges impossible.
  
  You decided to remove some bridges to meet all these M requests.
  
  Find the minimum number of bridges that must be removed.
samples: [{"input": "5 2\n    1 4\n    2 5", "output": "1\n    \n\nThe requests can be met by removing the bridge connecting the second and third\nislands from the west.\n\n* * *"}, {"input": "9 5\n    1 8\n    2 7\n    3 5\n    4 6\n    7 9", "output": "2\n    \n\n* * *"}, {"input": "5 10\n    1 2\n    1 3\n    1 4\n    1 5\n    2 3\n    2 4\n    2 5\n    3 4\n    3 5\n    4 5", "output": "4"}]