#include <cstdio>
#include <algorithm>
#define rg register
using namespace std;

inline int read()
{
	int x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	return x * w; 
}
int n,p;
int a[100010],b[100010],c[100010];
int main()
{
	n=read();
	for(rg int i=1;i<=n;i++) a[i]=read();
	for(rg int i=1;i<=n;i++)
		for(rg int j=i+1;j<=n;j++)
		{
			int x=0;
			for(rg int k=i;k<=j;k++) b[++x]=a[k];
			sort(b+1,b+1+x);
			c[++p]=b[(j-i+1)/2+1];
		}
	for(int i=1;i<=n;i++) c[++p]=a[i];
	sort(a+1,a+1+p);
	printf("%d",c[p/2+1]);
	return 0; 
}
