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.
n = int(input())
l_t = input().split(' ')
l = []
for i in l_t:
  l.append(int(i))
  
print(l)
print(n)
n = int(input())

t_l = input().split()
l = []
for i in t_l:
    l.append(int(i))

h = [-1 for i in l]

h[0] = 0
h[1] = abs(l[0] - l[1])

i = 2
while i < len(l):
    h[i] = min(h[i-1] + abs(l[i-1] - l[i]), 
    h[i-2] + abs(l[i-2] -l[i]))
    i+=1

print(h[len(l)-1])



