output_description: Print the minimum total cost required to complete all the task.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      A_1 A_2 A_3
attempt: N, M = list(map(int, input().split(" ")))
  edges = []
  for i in range(M):
      a, b = list(map(int, input().split(" ")))
      edges.append([v for v in range(a, b)])
  
  ans = 0
  while any(edges):
      hit_index = 0
      max_hit = 0
      edge = []
      for i in range(len(edges)):
          if edges[i]:
              edge = edges[i]
              break
      for v in edge[::-1]:
          hit = 0
          for i in range(M):
              if edges[i] and v in edges[i]:
                  hit += 1
              if hit > max_hit:
                  max_hit = hit
                  hit_index = v
      # print('max_hit')
      # print(max_hit)
      # print('cut here')
      # print(hit_index)
      for i in range(len(edges)):
          if edges[i] and hit_index in edges[i]:
              edges[i] = False
      ans += 1
      # print('cutted')
      # print(edges)
  print(ans)
  
problem_description: Statement
  
  You have three tasks, all of which need to be completed.
  
  First, you can complete any one task at cost 0.
  
  Then, just after completing the i-th task, you can complete the j-th task at
  cost |A_j - A_i|.
  
  Here, |x| denotes the absolute value of x.
  
  Find the minimum total cost required to complete all the task.
samples: [{"input": "1 6 3", "output": "5\n    \n\nWhen the tasks are completed in the following order, the total cost will be 5,\nwhich is the minimum:\n\n  * Complete the first task at cost 0.\n  * Complete the third task at cost 2.\n  * Complete the second task at cost 3.\n\n* * *"}, {"input": "11 5 5", "output": "6\n    \n\n* * *"}, {"input": "100 100 100", "output": "0"}]