U505210 Green Tree

题目背景

[Chinese Statement](https://www.luogu.com.cn/problem/P11242). **You must submit your code at the Chinese version of the statement.** > Unconstrained, chivalrous but cultivated.

题目描述

Looking at the sequence of symbols that Trine cannot understand, he decides to tell you about a competitive programming problem first. Trine has a rooted tree with exactly $k$ leaves, whose depths are respectively $a_1\dots a_k$. He want you to help him calculate the minimum number of nodes of such a tree. Trine guarantees that there is at least one such tree. If you are not familiar with some of the definitions in the problem, we would like to remind you: - A **simple path** on a graph is a path that does not go through the same node or edge more than once. - A **tree** is a connected graph, in which each two nodes have only one simple path in between. In a tree, we must select a node as the root. - A **leaf** is a node in a tree, which has a degree of $1$ and is not the root. - The **depth** of a node in a tree is the number of nodes on the simple graph between it and the root.

输入格式

输出格式

说明/提示

In the first sample test case, one possible tree is as shown in the following figure: ![](https://cdn.luogu.com.cn/upload/image_hosting/kh6cgtyp.png?x-oss-process=image/resize,m_lfit,h_400,w_400) which contains $8$ nodes. Leaves $3, 5, 6, 8$ have depths $2, 3, 4, 5$ respectively. It can be proven there is no such tree with $7$ nodes or fewer.