Wilbur the pig is tinkering with arrays again. He has the array a1, a2, ..., an initially consisting of n zeros. At one step, he can choose any index i and either add 1 to all elements ai, ai + 1, ... , an or subtract 1 from all elements ai, ai + 1, ..., an. His goal is to end up with the array b1, b2, ..., bn. 

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 ai. Initially ai = 0 for every position i, so this array is not given in the input.

The second line of the input contains n integers b1, b2, ..., bn ( - 109 ≤ bi ≤ 109).

Output

Print the minimum number of steps that Wilbur needs to make in order to achieve ai = bi 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.
import javafx.util.Pair;

import java.io.*;
import java.util.*;

public class Main {
    private final static InputReader ir = new InputReader(System.in);
    private final static OutputWriter ow = new OutputWriter(System.out);
    private final static int INF = Integer.MAX_VALUE;
    private final static int NINF = Integer.MIN_VALUE;
    private final static double PI = Math.PI;

    public static void main(String[] args) throws IOException {
        try {
            task();
        } finally {
            boolean exc = false;
            try {
                ir.close();
            } catch (IOException e) {
                e.printStackTrace();
                exc = true;
            }
            try {
                ow.close();
            } catch (IOException e) {
                e.printStackTrace();
                exc = true;
            }
            if (exc) System.exit(1);
        }
    }

    private static void task() throws IOException {
        int n = ir.nextInt();
        long ans = 0;
        int val = 0;

        for (int i = 0; i < n; ++i) {
            int bi = ir.nextInt();
            ans += abs(bi - val);
            val = bi;
        }

        ow.print(ans);
        /*
        boolean[] array = new boolean[10001];

        for (int i = 0; i <= 10000; ++i)
            array[i] = true;

        for (int i = 2; i <= 100; ++i) {
            if (array[i]) {
                for (int j = i; j <= 10000 / i; ++j) {
                    array[j * i] = false;
                }
            }
        }
        int cnt = 0;
        for (int i = 2; i <= 10000; ++i)
            if (array[i]) ++cnt;
        ow.println(cnt);

        for (int i = 0; i <= 10000; ++i)
            array[i] = true;

        for (int i = 2; i <= 100; ++i) {
            if (array[i]) {
                for (int j = i * i; j <= 10000; j += i) {
                    array[j] = false;
                }
            }
        }

        cnt = 0;
        for (int i = 2; i <= 10000; ++i)
            if (array[i]) ++cnt;
        ow.println(cnt);
//        for (int i = 0; i < 10000; ++i)
//            if (array[i])
//                ow.println(i);

*/
    }

    private static int max(int... objects) {
        if (objects.length == 0)
            throw new IllegalArgumentException("objects.length == 0");
        int max = objects[0];
        for (int i = 1; i < objects.length; ++i) {
            if (max < objects[i])
                max = objects[i];
        }
        return max;
    }

    private static int min(int... objects) {
        if (objects.length == 0)
            throw new IllegalArgumentException("objects.length == 0");
        int min = objects[0];
        for (int i = 1; i < objects.length; ++i) {
            if (min > objects[i])
                min = objects[i];
        }
        return min;
    }

    private static long pow(int x, int n) {
        if (x == 0) return 0;
        if (x == 1 || n == 0) return 1;
        if (n == 1) return x;
        long t = pow(x, n / 2);
        if (n % 2 == 0) return t * t;
        else return t * t * x;
    }

    private static int abs(int a) {
        return (a >= 0 ? a : -a);
    }
}

class SQRTDecomposition {
    private int[] array;
    private int len;
    private int[] max;
    private int[] min;

    public SQRTDecomposition(int[] arr) {
        array = new int[arr.length];
        System.arraycopy(arr, 0, array, 0, arr.length);
        len = (int) Math.sqrt(array.length) + 1;
        max = new int[len];
        min = new int[len];
        for (int i = 0; i < array.length; ++i) {
            max[i / len] = min[i / len] = array[i];
        }
        for (int i = 0; i < array.length; ++i) {
            max[i / len] = Math.max(max[i / len], array[i]);
            min[i / len] = Math.min(min[i / len], array[i]);
        }
    }

    public int get(int i) {
        if (i <= 0 || i >= array.length)
            throw new IndexOutOfBoundsException("Index: " + i);
        return array[i];
    }

    public int length() {
        return array.length;
    }

    public int max(int l, int r) {
        int cl = l / len, cr = r / len;
        int m = array[l];
        if (cl == cr) {
            for (int i = l; i <= r; ++i) {
                if (array[i] > m) m = array[i];
            }
        } else {
            for (int i = l, end = (cl + 1) * len - 1; i <= end; ++i)
                if (array[i] > m) m = array[i];
            for (int i = cl + 1; i <= cr - 1; ++i)
                if (max[i] > m) m = max[i];
            for (int i = cr * len; i <= r; ++i)
                if (array[i] > m) m = array[i];
        }
        return m;
    }

    public int min(int l, int r) {
        int cl = l / len, cr = r / len;
        int m = array[l];
        if (cl == cr) {
            for (int i = l; i <= r; ++i) {
                if (array[i] < m) m = array[i];
            }
        } else {
            for (int i = l, end = (cl + 1) * len - 1; i <= end; ++i)
                if (array[i] < m) m = array[i];
            for (int i = cl + 1; i <= cr - 1; ++i)
                if (min[i] < m) m = min[i];
            for (int i = cr * len; i <= r; ++i)
                if (array[i] < m) m = array[i];
        }
        return m;
    }
}

class InputReader implements AutoCloseable {
    private final InputStream in;
    private int capacity;
    private byte[] buffer;
    private int len = 0;
    private int cur = 0;

    public InputReader(InputStream stream) {
        this(stream, 100_000);
    }

    public InputReader(InputStream stream, int capacity) {
        this.in = stream;
        this.capacity = capacity;
        buffer = new byte[capacity];
    }

    private int read() {
        if (cur >= len) {
            try {
                cur = 0;
                len = in.read(buffer, 0, capacity);
                if (len <= 0)
                    return -1;
            } catch (IOException e) {
                throw new InputMismatchException();
            }
        }
        return buffer[cur++];
    }

    private boolean isSpace(int c) {
        return c == ' ' || isEscape(c);
    }

    private boolean isEscape(int c) {
        return c == '\n' || c == '\t' || c == '\r' || c == -1;
    }

    private int readSkipSpace() {
        int c;
        do {
            c = read();
        } while (isSpace(c));
        return c;
    }

    int nextInt() {
        int c = readSkipSpace();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res = res * 10 + c - '0';
            if (res < 0)
                throw new InputMismatchException();
            c = read();
        } while (!isSpace(c));
        res *= sgn;
        return res;
    }

    public long nextLong() {
        int c = readSkipSpace();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res = res * 10 + c - '0';
            if (res < 0)
                throw new InputMismatchException();
            c = read();
        } while (!isSpace(c));
        res *= sgn;
        return res;
    }

    int nextChar() {
        return readSkipSpace();
    }

    String nextLine(int initialCapacity) {
        StringBuilder res = new StringBuilder(initialCapacity);
        int c = readSkipSpace();
        do {
            res.append((char) (c));
            c = read();
        } while (!isEscape(c));
        return res.toString();
    }

    @Override
    public void close() throws IOException {
        in.close();
    }
}

class OutputWriter implements Flushable, AutoCloseable {
    private byte[] buf;
    private int capacity;
    private int count;
    private OutputStream out;

    public OutputWriter(OutputStream stream) {
        out = stream;
        capacity = 10_000;
        buf = new byte[capacity];
    }

    public OutputWriter(OutputStream stream, int capacity) {
        if (capacity <= 0)
            throw new IllegalArgumentException("capacity <= 0");
        out = stream;
        this.capacity = capacity;
        buf = new byte[capacity];
    }

    public void write(int b) throws IOException {
        if (count >= buf.length)
            flushBuffer();
        buf[count++] = (byte) b;
    }

    public void write(byte[] bytes, int off, int len) throws IOException {
        if (len >= buf.length) {
            flushBuffer();
            out.write(bytes, off, len);
            return;
        }
        if (len > buf.length - count)
            flushBuffer();
        System.arraycopy(bytes, off, buf, count, len);
        count += len;
    }

    public void write(byte[] bytes) throws IOException {
        write(bytes, 0, bytes.length);
    }

    public void print(String str) throws IOException {
        write(str.getBytes());
    }

    public void println() throws IOException {
        print("\n");
    }

    public void print(Object object) throws IOException {
        print(object.toString());
    }

    public void println(Object object) throws IOException {
        print(object.toString());
        println();
    }

    public void print(int... ints) throws IOException {
        print(" ", ints);
    }

    public void println(int... ints) throws IOException {
        print(ints);
        println();
    }

    public void println(String separator, int... ints) throws IOException {
        print(separator, ints);
        println();
    }

    public void print(String separator, int... ints) throws IOException {
        if (ints.length == 0) throw new IllegalArgumentException("ints.length == 0");
        for (int i = 0; i < ints.length; ++i) {
            if (i != 0) print(separator);
            print(ints[i]);
        }
    }

    private void flushBuffer() throws IOException {
        if (count > 0) {
            out.write(buf, 0, count);
            count = 0;
        }
    }

    @Override
    public void flush() throws IOException {
        flushBuffer();
        out.flush();
    }

    @Override
    public void close() throws IOException {
        flush();
        out.close();
    }
}





