#D7122. Clique Coloring

    ID: 5919 Type: Default 2000ms 268MiB

Clique Coloring

Clique Coloring

There is a complete graph of m vertices. Initially, the edges of the complete graph are uncolored. Sunuke did the following for each i (1 ≤ i ≤ n): Select ai vertices from the complete graph and color all edges connecting the selected vertices with color i. None of the sides were painted in multiple colors. Find the minimum value that can be considered as m.

Constraints

  • 1 ≤ n ≤ 5
  • 2 ≤ ai ≤ 109

Input

n a1 .. .. an

Output

Output the minimum value of m on one line.

Examples

Input

2 3 3

Output

5

Input

5 2 3 4 5 6

Output

12

inputFormat

Input

n a1 .. .. an

outputFormat

Output

Output the minimum value of m on one line.

Examples

Input

2 3 3

Output

5

Input

5 2 3 4 5 6

Output

12

样例

5
2
3
4
5
6
12