N=int(eval(input()))



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

S=[0]*100010

for i in range(N):

    S[i]=L[i]



DP=[10**12]*100010



DP[0]=0

for i in range(N):

    if DP[i+1]>DP[i]+abs(S[i+1]-S[i]):

        DP[i+1]=DP[i]+abs(S[i+1]-S[i])

    if DP[i+2]>DP[i]+abs(S[i+2]-S[i]):

        DP[i+2]=DP[i]+abs(S[i+2]-S[i])





print((DP[N-1]))



            
N=int(eval(input()))

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



DP=[10**6]*(10**6)



def chmin(a,b):

    if a>b:

        return b

    else:

        return a



def chmax(a,b):

    if a>b:

        return a

    else:

        return b



DP[0]=0

DP[1]=abs(S[1]-S[0])



for i in range(2,N):

    DP[i]=chmin(DP[i-1]+abs(S[i-1]-S[i]),DP[i-2]+abs(S[i-2]-S[i]))

    

print((DP[N-1]))
N = int(eval(input()))
L = list(map(int, input().split()))
S = [0] * 100010
for i in range(N):
    S[i] = L[i]
DP = [10**12] * 100010
DP[0] = 0
for i in range(N):
    if DP[i + 1] > DP[i] + abs(S[i + 1] - S[i]):
        DP[i + 1] = DP[i] + abs(S[i + 1] - S[i])
    if DP[i + 2] > DP[i] + abs(S[i + 2] - S[i]):
        DP[i + 2] = DP[i] + abs(S[i + 2] - S[i])
print((DP[N - 1]))

N = int(eval(input()))
S = list(map(int, input().split()))
DP = [10**6] * (10**6)


def chmin(a, b):
    if a > b:
        return b
    else:
        return a


def chmax(a, b):
    if a > b:
        return a
    else:
        return b


DP[0] = 0
DP[1] = abs(S[1] - S[0])
for i in range(2, N):
    DP[i] = chmin(DP[i - 1] + abs(S[i - 1] - S[i]), DP[i - 2] + abs(S[i - 2] - S[i]))
print((DP[N - 1]))

-L = list(map(int, input().split())) -S = [0] * 100010 -for i in range(N): -    S[i] = L[i] -DP = [10**12] * 100010 +S = list(map(int, input().split())) +DP = [10**6] * (10**6) + + +def chmin(a, b): +    if a > b: +        return b +    else: +        return a + + +def chmax(a, b): +    if a > b: +        return a +    else: +        return b + + -for i in range(N): -    if DP[i + 1] > DP[i] + abs(S[i + 1] - S[i]): -        DP[i + 1] = DP[i] + abs(S[i + 1] - S[i]) -    if DP[i + 2] > DP[i] + abs(S[i + 2] - S[i]): -        DP[i + 2] = DP[i] + abs(S[i + 2] - S[i]) +DP[1] = abs(S[1] - S[0]) +for i in range(2, N): +    DP[i] = chmin(DP[i - 1] + abs(S[i - 1] - S[i]), DP[i - 2] + abs(S[i - 2] - S[i]))