N = int(eval(input()))

h = list(map(int, input().split()))

import numpy as np

dp = np.zeros(N+1, dtype=int)

dp[2] = abs(h[0]-h[1])

for i in range(2, N):

    dp[i+1] = min(

        dp[i] + abs(h[i-1]-h[i]),

        dp[i-1] + abs(h[i-2]-h[i])

    )

print((dp[N]))

n = int(eval(input()))

h = [0] + list(map(int, input().split()))

inf = 10**5

dp = [inf]*(n+1)

dp[1] = 0

dp[2] = abs(h[1] - h[2])

for i in range(3, n+1):

    dp[i] = min(

        dp[i-1] + abs(h[i-1] - h[i]),

        dp[i-2] + abs(h[i-2] - h[i])

    )



print((dp[n]))
N = int(eval(input()))
h = list(map(int, input().split()))
import numpy as np

dp = np.zeros(N + 1, dtype=int)
dp[2] = abs(h[0] - h[1])
for i in range(2, N):
    dp[i + 1] = min(dp[i] + abs(h[i - 1] - h[i]), dp[i - 1] + abs(h[i - 2] - h[i]))
print((dp[N]))

n = int(eval(input()))
h = [0] + list(map(int, input().split()))
inf = 10**5
dp = [inf] * (n + 1)
dp[1] = 0
dp[2] = abs(h[1] - h[2])
for i in range(3, n + 1):
    dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]))
print((dp[n]))

-N = int(eval(input())) -h = list(map(int, input().split())) -import numpy as np - -dp = np.zeros(N + 1, dtype=int) -dp[2] = abs(h[0] - h[1]) -for i in range(2, N): -    dp[i + 1] = min(dp[i] + abs(h[i - 1] - h[i]), dp[i - 1] + abs(h[i - 2] - h[i])) -print((dp[N])) +n = int(eval(input())) +h = [0] + list(map(int, input().split())) +inf = 10**5 +dp = [inf] * (n + 1) +dp[1] = 0 +dp[2] = abs(h[1] - h[2]) +for i in range(3, n + 1): +    dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i])) +print((dp[n]))