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())
  a,b = [0 for i in range(M)],[0 for i in range(M)]
  A,B = [0 for i in range(M)],[0 for i in range(M)]
  t = 0
  for i in range(M):
  	a[i],b[i] = map(int,input().split())
  	flug = -1
  	for j in range(t):
  		if a[i]<A[j] and b[i]>B[j]:
  			A[j] = b[i]
  			B[j] = a[i]
  			flug = 1
  	if flug = -1:
  		A[t] = b[i]
  		B[t] = a[i]
  		t = t + 1
  
  print(t)
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"}]