using System;
public class Test
{
public static void Main()
{
int test = Convert.ToInt32(Console.ReadLine());
List<int> input = Console.ReadLine()
.Split(' ') // Split input by spaces
.Select(int.Parse) // Convert each part to an int
.ToList(); // Store in a List<int>
input.Sort();
input.Reverse();
for (int i = 0; i < test; i++)
{
// Use a for loop to process the list
for (int a = input.Count - 1; a > 0; a--)
{
// Combine the two smallest elements (last two in the sorted list)
int combined = (input[a] + input[a - 1]) - 1;
// Remove the two smallest elements
input.RemoveAt(a); // Remove last element
input.RemoveAt(a - 1); // Remove second last element
// Add the combined value to the end of the list
input.Add(combined);
// Re-adjust the loop variable `a` because the list size has changed
a = input.Count; // Reset `a` to the new size of the list
}
}
// Output the final remaining element
Console.WriteLine(input[0]);
}
}