Question
Drone Battery Hops

A delivery drone must cross N charging towers in order. Tower i has height H_i.

The drone starts at tower 1 and wants to reach tower N. From any tower, it may jump to the next tower or skip one tower and jump two positions ahead.

The energy cost of jumping from tower i to tower j is |H_i - H_j|. Find the minimum total energy required.

The hidden idea: the best cost to reach a tower depends only on the best costs of the previous one or two towers.

Input

The first line contains an integer KaTeX can only parse string typed expression.

The second line contains KaTeX can only parse string typed expression integers KaTeX can only parse string typed expression.

Output

Print a single integer — the minimum total energy required to reach tower KaTeX can only parse string typed expression.

Example
Example 1:
Input
4

10 30 40 20
Output
30
Explanation
One optimal path is tower KaTeX can only parse string typed expression, costing KaTeX can only parse string typed expression.

Example 2:
Input
2

7 4
Output
3

Online