#include int main(void) { int i, n, s[100000], a = 0, b = 0; scanf("%d", &n); for( i = 0; i < n; i++) { scanf("%d", &s[i]); if ( s[i] > a ) a = s[i]; if ( s[i] < a && s[i] > b ) b = s[i]; } printf("%d\n", b); return 0; }