n = int(eval(input()))

h = [int(x) for x in input().split()]



def abs(x):

    if x >= 0:

        return x

    return -x



c = [0]

c.append(abs(h[1] - h[0]))

for k in range(2, n):

    cnext = min(c[k-2] + abs(h[k]-h[k-2]), c[k-1] + abs(h[k] - h[k-1]))

    c.append(cnext)



print((c[-1]))
n = int(eval(input()))

h = input().split()

h = [int(i) for i in h]



aux = [10000000000 for i in range(n)] 

aux[0] = 0

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



for i in range(2,n):

    aux[i] = min(aux[i - 2] + abs(h[i] - h[i - 2]), aux[i - 1] + abs(h[i] - h[i - 1]))



print((aux[n-1]))

    
n = int(eval(input()))
h = [int(x) for x in input().split()]


def abs(x):
    if x >= 0:
        return x
    return -x


c = [0]
c.append(abs(h[1] - h[0]))
for k in range(2, n):
    cnext = min(c[k - 2] + abs(h[k] - h[k - 2]), c[k - 1] + abs(h[k] - h[k - 1]))
    c.append(cnext)
print((c[-1]))

n = int(eval(input()))
h = input().split()
h = [int(i) for i in h]
aux = [10000000000 for i in range(n)]
aux[0] = 0
aux[1] = abs(h[1] - h[0])
for i in range(2, n):
    aux[i] = min(aux[i - 2] + abs(h[i] - h[i - 2]), aux[i - 1] + abs(h[i] - h[i - 1]))
print((aux[n - 1]))

-h = [int(x) for x in input().split()] - - -def abs(x): -    if x >= 0: -        return x -    return -x - - -c = [0] -c.append(abs(h[1] - h[0])) -for k in range(2, n): -    cnext = min(c[k - 2] + abs(h[k] - h[k - 2]), c[k - 1] + abs(h[k] - h[k - 1])) -    c.append(cnext) -print((c[-1])) +h = input().split() +h = [int(i) for i in h] +aux = [10000000000 for i in range(n)] +aux[0] = 0 +aux[1] = abs(h[1] - h[0]) +for i in range(2, n): +    aux[i] = min(aux[i - 2] + abs(h[i] - h[i - 2]), aux[i - 1] + abs(h[i] - h[i - 1])) +print((aux[n - 1]))