An allergy test is carried out over several days. On each day you may be exposed to substances called allergens, and the goal is to determine exactly which allergens you are allergic to.
Each allergen has a live duration $D$, measured in whole days: if you are allergic to it, you suffer an allergic reaction for exactly $D$ days. The reaction begins almost immediately after you are exposed to an allergen you are allergic to.
Each day has two fixed action points:
Thus an allergen with live duration $D$ affects exactly $D$ evening examinations.
If two or more allergens are active in your body at the moment a reaction is observed, that observation alone cannot tell you which of those substances you are allergic to.
You want the shortest possible test scheme for the given allergen durations. The scheme must be non-adaptive: it is fixed in advance, so you may not choose when to apply an allergen based on the outcomes of earlier examinations. Determine the minimum number of days a conclusive scheme needs.
The first line contains a single integer $k$ ($1 \le k \le 20$), the number of allergens being tested. Each of the next $k$ lines contains a single integer $D$ ($1 \le D \le 7$), the live duration of one allergen.
Print the number of days of the shortest conclusive non-adaptive test scheme.
A scheme ends on the morning when you no longer have any active allergens in your body; thus a test scheme for a single allergen with live duration $D$ takes $D$ days.