Inviting the Village Chief
InterviewTime limit1sMemory limit128 MB
Plant one tree per day in the best order and report the earliest day after all trees have finished growing.
Problem
Farmer Sanggeun bought tree saplings to plant in his yard. Planting one sapling takes a full day, and he knows exactly how many days each sapling needs before it is fully grown.
Sanggeun wants to invite the village chief over and show off the trees he planted. He will not let the chief down, so he waits until every tree has finished growing. He invites the chief on the day after the last tree is fully grown.
Sanggeun plants one sapling per day starting on day 1, and he may choose the planting order however he likes. A sapling planted on day that needs days to grow is fully grown on day .
He picks the order that lets him invite the chief as early as possible. Which day does he invite him?
Input
The input has two lines. The first line has the number of saplings (). The second line has () separated by spaces, where is the number of days the -th sapling needs to grow.
Output
Print the earliest day on which Sanggeun can invite the village chief. The day he bought the saplings is day 1.