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: # _*_ coding:utf-8 _*_
  #  Atcoder_EducationDP_ContestX-1_other2
  #  TODO https://atcoder.jp/contests/dp/tasks/dp_a
  #  参考文献 https://qiita.com/drken/items/dc53c683d6de8aeacf5a#%E8%A7%A3%E6%B3%95
  #  C++ バージョンを上から書き下す
  #  TODO メモ化再帰
  #  https://qiita.com/drken/items/dc53c683d6de8aeacf5a#%E5%88%A5%E8%A7%A3-2-%E3%83%A1%E3%83%A2%E5%8C%96%E5%86%8D%E5%B8%B0
  import sys
  
  # 初期化
  # 足場の数となる要素数は足場の値の最大値であるMAX
  blockMAXElement = 100010
  blockElementRange = range(0, blockMAXElement, +1)
  # DPテーブルの中身は今回は最小値を求めるため最大値を利用
  
  dp = [sys.maxsize] * blockMAXElement
  # コスト
  # 参考文献のC++では配列は宣言時に初期化されるがpythonはそれがないのでまずはあえて0で初期化
  h = [0] * blockMAXElement
  # 入力データ諸々
  N = int(input().strip())
  inputh = list(map(int, input().strip().split(" ")))
  # h配列を入力データから取り出した物に置き換える
  for i in range(0, len(inputh), +1):
      h[i] = inputh[i]
  
  # 初期の条件 0歩の時だけはコストがないので、0にセット
  dp[0] = 0
  
  
  def rec(position):
      # まずは最大値にセット(上でもやっているのだが)
      answer = sys.maxsize
      if position == 0:
          answer = 0
      # もしメモを見てデフォルトでセットされた最大値以下であれば更新済みなのでその値をそのまま返す
      elif dp[position] < sys.maxsize:
          answer = dp[position]
      else:
          # 貰うDPを想定して組む
          # 一つ手前の足場から来た場合
          nowCost = rec(position - 1) + abs(h[position] - h[position - 1])
          if nowCost < answer:
              answer = nowCost
          # 二つ手前から来た場合→position = 1では-1を参照するので不具合
          if 2 <= position:
              nowCost = rec(position - 2) + abs(h[position] - h[position - 2])
              if nowCost < answer:
                  answer = nowCost
      # この位置についての最小値はdp配列にメモする
      dp[position] = answer
      return answer
  
  
  answer = rec(N - 1)
  print("{}".format(answer))
  
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."}]