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 math, sys, bisect, heapq
  from collections import defaultdict, Counter, deque
  from itertools import groupby, accumulate
  
  # sys.setrecursionlimit(200000000)
  input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
  ilele = lambda: map(int, input().split())
  alele = lambda: list(map(int, input().split()))
  
  
  def list2d(a, b, c):
      return [[c] * b for i in range(a)]
  
  
  # def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
  MOD = 1000000000 + 7
  
  
  def Y(c):
      print(["NO", "YES"][c])
  
  
  def y(c):
      print(["no", "yes"][c])
  
  
  def Yy(c):
      print(["No", "Yes"][c])
  
  
  def fun(A, N):
      dp = [0] * N
      for pos in range(N):
          if pos == 0:
              dp[pos] = 0
          elif pos == 1:
              dp[pos] = abs(A[pos - 1] - A[pos])
          else:
              dp[pos] = min(
                  abs(A[pos] - A[pos - 1]) + dp[pos - 1],
                  abs(A[pos] - A[pos - 2]) + dp[pos - 2],
              )
      return dp[-1]
  
  
  N = int(input())
  A = alele()
  print(fun(A, N))
  
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."}]