#include <bits/stdc++.h>
using namespace std;
int main(){
    int a[15]={0},m=0,n,d,e;
    cin>>n;
    for(m=0;m<n;m++){
        cin>>a[m];
    }
    for(m=0;m<n;m++){
        if(m!=0 and m!=n-1){
            if(a[m]>a[m-1] and a[m]>a[m+1]){
                cout<<a[m]<<endl;
            }
        }
    }
}
/**************************************************************
	Problem: 1153
	User: lihean
	Language: C++
	Result: Accepted
	Time:9 ms
	Memory:2072 kb
****************************************************************/