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
  from functools import lru_cache, cmp_to_key
  from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest
  from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
  from collections import defaultdict as dd, deque, Counter as C, OrderedDict as od
  from itertools import combinations as comb, permutations as perm
  from bisect import bisect_left as bl, bisect_right as br, bisect
  from time import perf_counter
  from fractions import Fraction
  
  # sys.setrecursionlimit(pow(10, 6))
  # sys.stdin = open("input.txt", "r")
  # sys.stdout = open("output.txt", "w")
  mod = pow(10, 9) + 7
  mod2 = 998244353
  
  
  def data():
      return sys.stdin.readline().strip()
  
  
  def out(*var, end="\n"):
      sys.stdout.write(" ".join(map(str, var)) + end)
  
  
  def l():
      return list(sp())
  
  
  def sl():
      return list(ssp())
  
  
  def sp():
      return map(int, data().split())
  
  
  def ssp():
      return map(str, data().split())
  
  
  def l1d(n, val=0):
      return [val for i in range(n)]
  
  
  def l2d(n, m, val=0):
      return [l1d(n, val) for j in range(m)]
  
  
  n = int(data())
  arr = l()
  dp = dd(lambda: inf)
  dp[n - 1] = 0
  for i in range(n - 2, -1, -1):
      dp[i] = min(dp[i], dp[i + 1] + abs(arr[i + 1] - arr[i]))
      if i != n - 2:
          dp[i] = min(dp[i], dp[i + 2] + abs(arr[i + 2] - arr[i]))
  out(dp[0])
  
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."}]