Squirrel Liss loves nuts. There are *n* trees (numbered 1 to *n* from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree *i* is *h*<sub class="lower-index">*i*</sub>. Liss wants to eat all nuts.

Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actions:
 -  Walk up or down one unit on a tree. -  Eat a nut on the top of the current tree. -  Jump to the next tree. In this action the height of Liss doesn't change. More formally, when Liss is at height *h* of the tree *i* (1 ≤ *i* ≤ *n* - 1), she jumps to height *h* of the tree *i* + 1. This action can't be performed if *h* &gt; *h*<sub class="lower-index">*i* + 1</sub>. 
Compute the minimal time (in seconds) required to eat all nuts.
The first line contains an integer *n* (1  ≤  *n* ≤ 10<sup class="upper-index">5</sup>) — the number of trees.

Next *n* lines contains the height of trees: *i*-th line contains an integer *h*<sub class="lower-index">*i*</sub> (1 ≤ *h*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">4</sup>) — the height of the tree with the number *i*.
#!/usr/bin/env pypy3

# from __future__ import annotations  # CodeForces PyPy version is 7.3.0, which doesn't support Python 3.7

import platform
from array import *  # type: ignore
from bisect import *  # type: ignore
from collections import *  # type: ignore
from functools import *  # type: ignore
from itertools import *  # type: ignore
from math import *  # type: ignore
from pprint import pprint as pp
from typing import *  # type: ignore


# from more_itertools import *  # type: ignore

if platform.python_implementation() != "PyPy":
    raise RuntimeError(
        "Should use PyPy interpreter. "
        "This script is tailor made for PyPy environment."
    )

T = TypeVar("T")

rd = lambda: map(int, input().split())
rl = lambda: [int(s) for s in input().split()]
re = lambda: int(input())


def is_local_environment() -> bool:
    # A rough heuristics
    return platform.node() == "Inspiron-5000"


def localize(fn):
    @wraps(fn)
    def wrapper(*args, **kwargs):
        if not is_local_environment():
            return
        return fn(*args, **kwargs)

    return wrapper


pp = localize(pp)
p = localize(print)
print = 0

enu = enumerate
enumerate = 0


def pdbt() -> None:
    import pdb

    pdb.set_trace()


def mod(n: int) -> int:
    return n % (10 ** 9 + 7)  # 1e9 + 7


class ps:
    _cache = []

    def __init__(self, *args, **kwargs) -> None:
        self.__class__._cache.append((args, kwargs))
        # TODO use reflection to exit from solve() function

    @classmethod
    def flush(cls: Type) -> None:
        import builtins

        p("\033[92m", end="")

        for args, kwargs in cls._cache:
            builtins.print(*args, **kwargs)

        p("\033[0m", end="")


def psb(boolean: bool) -> None:
    if boolean:
        ps("yes")
    else:
        ps("no")


def log_recursion_error(fn):
    @wraps(fn)
    def wrapper(*args, **kwargs):
        try:
            return fn(*args, **kwargs)
        except RecursionError as e:
            import builtins
            import sys

            builtins.print("Encounter RecursionError", file=sys.stderr)
            sys.exit(200)

    return wrapper


def print_test_case(target_t: int, num: int, lines: int) -> None:
    num -= 1

    t = int(input())

    if t != target_t:
        for _ in range(t):
            solve()
        ps.flush()
        return

    assert num < t

    for i in range(t):
        test_case = "\n".join(input() for _ in range(lines))
        if i == num:
            import builtins

            builtins.print(test_case)
            sys.exit(201)


class Singleton:
    _singleton = None

    def __new__(cls: Type["Singleton"]) -> "Singleton":
        if cls._singleton is None:
            cls._singleton = object.__new__(cls)
        return cls._singleton


_sentinel = object()
NO_DEFAULT = object()


# Self implementation of more-itertools library's peekable()
class peekable(Iterator[T]):
    def __init__(self, iterable: Iterable[T]) -> None:
        self._iterable = iter(iterable)
        try:
            self._head = next(self._iterable)
        except StopIteration:
            self._head = _sentinel

    def peek(self, default=NO_DEFAULT) -> T:
        if self._head is _sentinel:
            if default is NO_DEFAULT:
                raise StopIteration
            else:
                return default
        else:
            return self._head

    def __bool__(self) -> bool:
        return self._head is not _sentinel

    def __getitem__(self) -> T:
        raise NotImplementedError

    def prepend(self) -> None:
        raise NotImplementedError

    def __next__(self) -> T:
        if self._head is _sentinel:
            raise StopIteration
        res = self._head
        try:
            self._head = next(self._iterable)
        except StopIteration:
            self._head = _sentinel
        return res

    def __iter__(self) -> Iterator[T]:
        return self


# Node = TypeVar("Node")
Node = Any
Graph = DefaultDict[Node, Set[Node]]


def bfs(graph: Graph, src: Node) -> Iterator[Set[Node]]:
    queue: Set[Node] = {src}
    seen: Set[Node] = set()
    while queue:
        new_queue = set()
        for node in queue:
            seen.add(node)
            for child in graph[node]:
                if child not in seen:
                    new_queue.add(child)
        yield queue
        queue = new_queue


def dfs(graph: Graph, src: Node) -> Iterator[Node]:
    stack: List[Node] = [src]
    seen: Set[Node] = set()
    while stack:
        node = stack.pop()
        if node in seen:
            continue
        yield node
        seen.add(node)
        for child in graph[node]:
            if child not in seen:
                stack.append(child)


# TODO segment tree library

# TODO primality test (fastest algorithm, plus a lot of optimization tricks)


@log_recursion_error
def solve() -> None:
    n = re()
    time = -1
    last = 0
    for _ in range(n):
        h = re()
        time += 2 + abs(h - last)
        last = h
    ps(time)


def main() -> None:
    t = 1
    for _ in range(t):
        solve()
    ps.flush()


if __name__ == "__main__":
    main()
    # print_test_case()
