#K53027. Smallest Remaining Element
Smallest Remaining Element
Smallest Remaining Element
Aisha is working on a new project involving sequences. Given an initial sequence of ( n ) positive integers, you are allowed to repeatedly perform the following operation: choose any two adjacent integers and remove the larger one. This process is repeated until only one integer remains in the sequence. Your task is to determine the smallest possible integer that can remain after all operations are completed. Essentially, since every operation removes the larger of two adjacent numbers, the smallest number in the initial sequence is guaranteed to remain. ( \textbf{Hint:} ) The answer is simply the minimum element of the sequence.
inputFormat
The first line contains an integer ( n ) ((2 \le n \le 1000)) representing the number of elements in the sequence. The second line contains ( n ) space-separated integers ( a_1, a_2, \dots, a_n ) with each ( a_i ) satisfying ( 1 \le a_i \le 1000 ).
outputFormat
Output a single integer which is the smallest possible integer that can remain after performing the operations.## sample
5
3 4 2 5 1
1