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 = list(map(int, input().split(" ")))
  left_list = list()
  right_list = list()
  for _ in range(M):
      a, b = list(map(int, input().split(" ")))
      left_list.append(a)
      right_list.append(b)
  sorted_blocking_section_list = sorted(range(M), key=lambda i: right_list[i])
  blocking_bridge = None
  blocking_bridge_cnt = 0
  for section in sorted_blocking_section_list:
      left_bridge = left_list[section]
      right_bridge = right_list[section] - 1
      if blocking_bridge is None or blocking_bridge < left_bridge:
          blocking_bridge = right_bridge
          blocking_bridge_cnt += 1
  print(blocking_bridge_cnt)
  
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"}]