output_description: Print the minimum possible total cost incurred.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      h_1 h_2 \ldots h_N
attempt: import sys
  
  inp = sys.stdin.readline
  read = lambda: list(map(int, inp().strip().split()))
  
  
  def a():
      n = int(inp())
      arr = read()
      dic = {0: 0, 1: abs(arr[0] - arr[1])}
  
      def func(arr, n):
          if n in dic:
              return dic[n]
          min_path = min(
              abs(arr[n] - arr[n - 1]) + func(arr, n - 1),
              abs(arr[n] - arr[n - 2]) + func(arr, n - 2),
          )
          dic[n] = min_path
          return min_path
  
      print(func(arr, n - 1))
      # print(dic)
  
  
  if __name__ == "__main__":
      a()
  
problem_description: Statement
  
  There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N),
  the height of Stone i is h_i.
  
  There is a frog who is initially on Stone 1. He will repeat the following
  action some number of times to reach Stone N:
  
    * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.
  
  Find the minimum possible total cost incurred before the frog reaches Stone N.
samples: [{"input": "4\n    10 30 40 20", "output": "30\n    \n\nIf we follow the path 1 \u2192 2 \u2192 4, the total cost incurred would be |10 - 30| +\n|30 - 20| = 30.\n\n* * *"}, {"input": "2\n    10 10", "output": "0\n    \n\nIf we follow the path 1 \u2192 2, the total cost incurred would be |10 - 10| = 0.\n\n* * *"}, {"input": "6\n    30 10 60 10 60 50", "output": "40\n    \n\nIf we follow the path 1 \u2192 3 \u2192 5 \u2192 6, the total cost incurred would be |30 -\n60| + |60 - 60| + |60 - 50| = 40."}]