Wilbur the pig is tinkering with arrays again. He has the array a_1, a_2, ..., a_{n} initially consisting of n zeros. At one step, he can choose any index i and either add 1 to all elements a_{i}, a_{i} + 1, ... , a_{n} or subtract 1 from all elements a_{i}, a_{i} + 1, ..., a_{n}. His goal is to end up with the array b_1, b_2, ..., b_{n}. 

Of course, Wilbur wants to achieve this goal in the minimum number of steps and asks you to compute this value.


-----Input-----

The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the array a_{i}. Initially a_{i} = 0 for every position i, so this array is not given in the input.

The second line of the input contains n integers b_1, b_2, ..., b_{n} ( - 10^9 ≤ b_{i} ≤ 10^9).


-----Output-----

Print the minimum number of steps that Wilbur needs to make in order to achieve a_{i} = b_{i} for all i.


-----Examples-----
Input
5
1 2 3 4 5

Output
5
Input
4
1 2 2 1

Output
3


-----Note-----

In the first sample, Wilbur may successively choose indices 1, 2, 3, 4, and 5, and add 1 to corresponding suffixes.

In the second sample, Wilbur first chooses indices 1 and 2 and adds 1 to corresponding suffixes, then he chooses index 4 and subtract 1.

Difficulty: interview

Starter code:

Solutions:
#!/usr/bin/env python3

try:
    while True:
        n = int(input())
        b = list(map(int, input().split()))
        cur = 0
        result = 0
        for x in b:
            result += abs(cur - x)
            cur = x
        print(result)
except EOFError:
    pass


read = lambda: map(int, input().split())
n = int(input())
a = [0] + list(read())

ans = sum(abs(a[i] - a[i - 1]) for i in range(1, n + 1))
print(ans)

n = int(input())
b = list(map(int, input().split()))
cur = 0
cnt = 0
for i in range(n):
	cnt += abs(cur - b[i])
	cur = b[i]
print(cnt)


n = int(input())
bs = list(map(int, input().split()))

def solve(n, bs):
    steps = 0
    level = 0
    for b in bs:
        steps += abs(level - b)
        level = b
    return steps

print(solve(n, bs))


n = int(input())
b = list(map(int, input().split()))
moves = 0
sum = 0
for i in range(n):
    moves += abs(b[i] + sum)
    sum -= (b[i] + sum)
print(moves)    

n = int(input())
ans = 0
a = [0] + list(map(int, input().split()))
for i in range(n):
    ans += abs(a[i + 1] - a[i])
print(ans)

N=int(input())
p=[0]+list(map(int,input().split()))
count=0
for i in range(len(p)-1):
    count+=abs(p[i+1]-p[i])
print(count)


def main():
	n = int(input())
	A = [0 for _ in range(n)]
	B = list(map(int, input().split()))
	other = 0
	k = 0

	for i in range(n):
		b = B[i]
		d = b - other
		k += abs(d)
		other += d

	return k

print(main())


s=0
cur = 0
x = int(input())
y = list(map(int, input().split(' ')))

for i in y:
    off = i + cur
    add = -off
    s += abs(add)
    cur += add

print(s)


ans = 0
n = int(input())
a = list(map(int, input().split())) + [0]
for i in range(n):
    ans += abs(a[i] - a[i - 1])
print(ans)


"""
Codeforces Round #331  (Div. 2)

Problem 596 B Wilbur and Array

@author yamaton
@date 2015-11-15
"""

import itertools as it
import functools
import operator
import collections
import math
import sys


def solve(xs, n):
    return abs(xs[0]) + sum(abs(b-a) for (a, b) in zip(xs, xs[1:]))


# def p(*args, **kwargs):
#     return print(*args, file=sys.stderr, **kwargs)


def main():
    n = int(input())
    xs = [int(_c) for _c in input().strip().split()]
    assert len(xs) == n

    result = solve(xs, n)
    print(result)


def __starting_point():
    main()

__starting_point()

import sys
# динамика!!!
# смотри на ограничения
# for i in range(n):
# n = int(input())
# s = input().split()
# a = [int(tmp) for tmp in input().split()]
n = int(input())
a = [int(tmp) for tmp in input().split()]
ans = 0
now = 0
for i in range(n):
    ans += abs(a[i] - now)
    now += a[i] - now
print(ans)

n = int(input())
l = [0] + list(map(int, input().split()))
res = 0
for i in range(n):
    res += abs(l[i] - l[i + 1])
print(res)

n = int(input())
a = [int(i) for i in input().split()]
a = [0] + a
ans = 0
for i in range(1, n + 1):
    ans += abs(a[i] - a[i - 1])
print(ans)

def solve():
    N = int(input())
    B = list(map(int, input().split()))

    h = 0

    ans = 0

    for b in B:
        ans += abs(h - b)
        h = b

    print(ans)


def __starting_point():
    solve()

__starting_point()

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import time

n   = int(input())
b   = [int(i) for i in input().split()]

start = time.time()

ans = b[0]
if ans < 0:
    ans = - ans

for i in range(1, n):
    d = b[i] - b[i-1]
    if d < 0:
        d = - d
    ans += d

print(ans)
finish = time.time()
#print(finish - start)


# inp = open('input.txt')
# outp = open('output.txt', 'w')
#
# a, b = list(map(int, inp.readline().split()))
# outp.write(str(a + b))

n = input()
a = list(map(int, input().split()))
ans = 0
k = 0
for i in a:
    ans += abs(i - k)
    k += (i - k)

print(ans)

n = int(input())
b = list(map(int, input().split()))
b.append(0)
ans = 0
for i in range(n):
    ans += abs(b[i] - b[i - 1])
print(ans)


n = int(input())
b = input().split()
counter = 0
x = 0
for i in b:
    counter += abs(x - int(i))
    x = int(i)
print(counter)

n = int(input())
a = list(map(int, input().split()))
prev = 0
S = 0

for i in range(n):
   S += abs(a[i] - prev)
   prev = a[i]

print(S)


n = int(input())
b = list(map(int, input().split()))

ans = abs(b[0])
for i in range(1, n):
    ans += abs(b[i] - b[i - 1])

print(ans)


N = int(input())
B = [ int(b) for b in input().split() ]
level = 0
step = 0
for i in range(N):
  if not B[i] == level:
    step += abs(B[i]-level)
    level = B[i]
print(step)

n = int(input())
b = list(map(int, input().split()))
cur = 0
ans = 0
for i in range(len(b)):
    ans += abs(cur - b[i])
    cur = b[i]
print(ans)