#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define MAXN 300010
#define inf 100000000
using namespace std;

int sz[MAXN],heavy[MAXN],edge[MAXN][30],ans,ans1,cnt,ans2,res=inf,ind,mxdpt;
vector<pair<int,int>>adj[MAXN],rollbk;
vector<int>depth[MAXN];

void dfsinit(int node,int par,int dpt){
	sz[node]=1;depth[dpt].pb(node);mxdpt=max(mxdpt,dpt);
	for(int i=0;i<adj[node].size();i++){
		int child=adj[node][i].first;
		int val=adj[node][i].second;
		if(child!=par){
			edge[node][val]=child;
			dfsinit(child,node,dpt+1);
			if(sz[child]>sz[heavy[node]]){
				heavy[node]=child;
			}
			sz[node]+=sz[child];
		}
	}
}

void merge(int node,int super){
	for(int i=0;i<26;i++){
		if(edge[node][i] && !edge[super][i]){
			edge[super][i]=edge[node][i];
			rollbk.pb(mp(super,i));
			ans+=sz[edge[node][i]];
		}
		else if(edge[node][i] && edge[super][i]){
			merge(edge[node][i],edge[super][i]);
		}
	}
}

void rollback(){
	for(int i=0;i<rollbk.size();i++){
		edge[rollbk[i].first][rollbk[i].second]=0;
	}
}

void dpthtrv(int dpt){
	if(dpt>mxdpt)
		return ;
	for(int j=0;j<depth[dpt].size();j++){
		int node=depth[dpt][j];
		if(heavy[node]==0){
			ans1++;ans=0;
			continue;
		}
		ans=sz[heavy[node]];
		ans2+=sz[node];
		for(int i=0;i<26;i++){
			if(edge[node][i]!=heavy[node] && edge[node][i]){
				merge(edge[node][i],heavy[node]);
			}
		}
		ans1+=ans;
		ans=0;
		rollback();
		rollbk.clear();
	}
	if(cnt+ans1<res){
		res=cnt+ans1;
		ind=dpt;
	}
	ans1=ans2=ans=0;
	cnt+=depth[dpt].size();
	dpthtrv(dpt+1);
}

int main(){
	ios_base::sync_with_stdio(false);
	int n,u,v;
	char x;
	cin>>n;
	for(int i=1;i<n;i++){
		cin>>u>>v>>x;
		adj[u].pb(mp(v,x-'a'));
		adj[v].pb(mp(u,x-'a'));
	}
	dfsinit(1,-1,1);
	dpthtrv(1);
	cout<<res<<"\n"<<ind<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define MAXN 300010
#define inf 100000000
using namespace std;

int sz[MAXN],heavy[MAXN],edge[MAXN][30],ans,ans1,ans2,res=inf,ind,mxdpt;
vector<pair<int,int>>adj[MAXN],rollbk;
vector<int>depth[MAXN];

void dfsinit(int node,int par,int dpt){
	sz[node]=1;depth[dpt].pb(node);mxdpt=max(mxdpt,dpt);
	for(int i=0;i<adj[node].size();i++){
		int child=adj[node][i].first;
		int val=adj[node][i].second;
		if(child!=par){
			edge[node][val]=child;
			dfsinit(child,node,dpt+1);
			if(sz[child]>sz[heavy[node]]){
				heavy[node]=child;
			}
			sz[node]+=sz[child];
		}
	}
}

void merge(int node,int super){
	for(int i=0;i<26;i++){
		if(edge[node][i] && !edge[super][i]){
			edge[super][i]=edge[node][i];
			rollbk.pb(mp(super,i));
			ans+=sz[edge[node][i]];
		}
		else if(edge[node][i] && edge[super][i]){
			merge(edge[node][i],edge[super][i]);
		}
	}
}

void rollback(){
	for(int i=0;i<rollbk.size();i++){
		edge[rollbk[i].first][rollbk[i].second]=0;
	}
}

void dpthtrv(int dpt){
	if(dpt==mxdpt)
		return ;
	for(int i=0;i<depth[dpt].size();i++){
		int node=depth[dpt][i];
		ans=sz[heavy[node]];
		ans2+=sz[node];
		for(int i=0;i<26;i++){
			if(edge[node][i]!=heavy[node] && edge[node][i]){
				merge(edge[node][i],heavy[node]);
			}
		}
		ans1+=ans;
		ans=0;
		rollback();
		rollbk.clear();
	}
	if(sz[1]-ans2+ans1<res){
		res=sz[1]-ans2+ans1;
		ind=dpt;
	}
	ans1=ans2=ans=0;
	dpthtrv(dpt+1);
}

int main(){
	ios_base::sync_with_stdio(false);
	int n,u,v;
	char x;
	cin>>n;
	for(int i=1;i<n;i++){
		cin>>u>>v>>x;
		adj[u].pb(mp(v,x-'a'));
		adj[v].pb(mp(u,x-'a'));
	}
	dfsinit(1,-1,1);
	dpthtrv(1);
	cout<<res<<"\n"<<ind<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define MAXN 300010
#define inf 100000000
using namespace std;

int sz[MAXN],heavy[MAXN],edge[MAXN][30],ans,ans1,cnt,ans2,res=inf,ind,mxdpt;
vector<pair<int,int>>adj[MAXN],rollbk;
vector<int>depth[MAXN];

void dfsinit(int node,int par,int dpt){
	sz[node]=1;depth[dpt].pb(node);mxdpt=max(mxdpt,dpt);
	for(int i=0;i<adj[node].size();i++){
		int child=adj[node][i].first;
		int val=adj[node][i].second;
		if(child!=par){
			edge[node][val]=child;
			dfsinit(child,node,dpt+1);
			if(sz[child]>sz[heavy[node]]){
				heavy[node]=child;
			}
			sz[node]+=sz[child];
		}
	}
}

void merge(int node,int super){
	for(int i=0;i<26;i++){
		if(edge[node][i] && !edge[super][i]){
			edge[super][i]=edge[node][i];
			rollbk.pb(mp(super,i));
			ans+=sz[edge[node][i]];
		}
		else if(edge[node][i] && edge[super][i]){
			merge(edge[node][i],edge[super][i]);
		}
	}
}

void rollback(){
	for(int i=0;i<rollbk.size();i++){
		edge[rollbk[i].first][rollbk[i].second]=0;
	}
}

void dpthtrv(int dpt){
	if(dpt>mxdpt)
		return ;
	for(int j=0;j<depth[dpt].size();j++){
		int node=depth[dpt][j];
		ans=sz[heavy[node]];
		ans2+=sz[node];
		for(int i=0;i<26;i++){
			if(edge[node][i]!=heavy[node] && edge[node][i]){
				merge(edge[node][i],heavy[node]);
			}
		}
		ans1+=ans;
		ans=0;
		rollback();
		rollbk.clear();
	}
	if(cnt+ans1<res){
		res=cnt+ans1;
		ind=dpt;
	}
	ans1=ans2=ans=0;
	cnt+=depth[dpt].size();
	dpthtrv(dpt+1);
}

int main(){
	ios_base::sync_with_stdio(false);
	int n,u,v;
	char x;
	cin>>n;
	for(int i=1;i<n;i++){
		cin>>u>>v>>x;
		adj[u].pb(mp(v,x-'a'));
		adj[v].pb(mp(u,x-'a'));
	}
	dfsinit(1,-1,1);
	dpthtrv(1);
	cout<<res<<"\n"<<ind<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define INF 0x3f3f3f3f
#define MP make_pair
#define PI pair<int,int>
#define FI first
#define SE second
#define test cout<<"here!!"<<endl
#define debug(x) cout<<#x<<" "<<x<<endl
using namespace std;
const int mx=3e5+10;
int n,m;
vector<int>vec[mx];
char ns[mx];
int dep[mx],sz[mx],a[mx],b[mx][26],cnt;
PI tp[mx];
void dfs2(int u,int rt,int d)
{
    for (int v:vec[u])
    {
        if (b[rt][ns[v]-'a']) dfs2(v,b[rt][ns[v]-'a'],d),++a[d];
        else
        {
            b[rt][ns[v]-'a']=v;
            tp[++cnt]=MP(rt,ns[v]-'a');
        }
    }
}
void dfs(int u)
{
    sz[u]=1;
    int rt=0;
    for (int v:vec[u])
    {
        dep[v]=dep[u]+1;
        dfs(v);
        sz[u]+=sz[v];
        if (sz[rt]<sz[v])
        {
            rt=v;
        }
    }
    cnt=0;
    for (int v:vec[u])
    {
        if (v!=rt)
        {
            dfs2(v,rt,dep[v]);
        }
    }
    for (int i=1;i<=cnt;++i)
    {
        b[tp[i].FI][tp[i].SE]=0;
    }
}
int main()
{
    int u,v;
    char s[2];
    scanf("%d",&n);
    for (int i=1;i<n;++i)
    {
        scanf("%d%d%s",&u,&v,s);
        vec[u].pb(v);
        ns[v]=s[0];
        b[u][s[0]-'a']=v;
    }
    dep[1]=0,sz[0]=-INF;
    dfs(1);
    for (int i=1;i<=n;++i)
    {
        ++a[dep[i]];
    }
    int ans=n,res=0;
    for (int i=1;i<=n&&a[i];++i)
    {
        if (n-a[i]<ans)
        {
            ans=n-a[i],res=i;
        }
    }
    printf("%d\n%d\n",ans,res);
}
//hellobig_tq


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define INF 0x3f3f3f3f
#define MP make_pair
#define PI pair<int,int>
#define FI first
#define SE second
#define test cout<<"here!!"<<endl
#define debug(x) cout<<#x<<" "<<x<<endl
using namespace std;
const int mx=3e5+10;
int n,m;
vector<int>vec[mx];
char ns[mx];
int dep[mx],sz[mx],a[mx],b[mx][26],cnt;
PI tp[mx];
void dfs2(int u,int rt,int d)
{
    for (int v:vec[u])
    {
        if (b[rt][ns[v]-'a']) dfs2(v,b[rt][ns[v]-'a'],d),++a[d];
        else
        {
            b[rt][ns[v]-'a']=v;
            tp[++cnt]=MP(rt,ns[v]-'a');
        }
    }
}
void dfs(int u)
{
    sz[u]=1;
    int rt=0;
    for (int v:vec[u])
    {
        dep[v]=dep[u]+1;
        dfs(v);
        sz[u]+=sz[v];
        if (sz[rt]<sz[v])
        {
            rt=v;
        }
    }
    cnt=0;
    for (int v:vec[u])
    {
        if (v!=rt)
        {
            dfs2(v,rt,dep[v]);
        }
    }
    for (int i=1;i<=cnt;++i)
    {
        b[tp[i].FI][tp[i].SE]=0;
    }
}
int main()
{
    int u,v;
    char s[2];
    scanf("%d",&n);
    for (int i=1;i<n;++i)
    {
        scanf("%d%d%s",&u,&v,s);
        vec[u].pb(v);
        ns[v]=s[0];
        b[u][s[0]-'a']=v;
    }
    dep[1]=0,sz[0]=-INF;
    dfs(1);
    for (int i=1;i<=n;++i)
    {
        ++a[dep[i]];
    }
    int ans=n,res=0;
    for (int i=1;i<=n&&a[i];++i)
    {
        if (n-a[i]<ans)
        {
            ans=n-a[i],res=i;
        }
    }
    printf("%d\n%d\n",ans,res);
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define FI first
#define SE second
#define MP make_pair
#define PI pair<int,int>
#define PL pair<ll,ll>
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
#define test cout<<"here!!!"<<endl
#define debug(x) cout<<#x<<" "<<x<<endl
#define DEBU
using namespace std;
const int mx=3e5+10;
const ll mod=1e9+7;
int n,m;
vector<PI>vec[mx];
set<int>s[mx];
int dep[mx],f[mx],sz[mx],ss[mx];
void dfs(int u,int fa)
{
    for (PI it:vec[u])
    {
        int v=it.FI;
        if (v!=fa)
        {
            dep[v]=dep[u]+1;
            if (dep[v]>=2)
            {
                s[f[u]].insert(it.SE);
            }
            dfs(v,u);
        }
    }
}
int main()
{
    int u,v;
    char q[2];
    scanf("%d",&n);
    for (int i=1;i<n;++i)
    {
        scanf("%d%d%s",&u,&v,q);
        vec[u].pb(MP(v,q[0]-'a'));
        f[v]=u;
    }
    dep[1]=0;
    dfs(1,0);
    for (int i=1;i<=n;++i)
    {
        ++sz[dep[i]];
        ss[dep[i]+1]+=s[i].size();
    }
    int ans=n,res=0;
    for (int i=1;i<=n;++i)
    {
        if (!sz[i+1]) break;
        if (n-sz[i]-sz[i+1]+ss[i]<ans)
        {
            ans=n-sz[i]-sz[i+1]+ss[i];
            res=i;
        }
    }
    printf("%d\n%d\n",ans,res);
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define FI first
#define SE second
#define MP make_pair
#define PI pair<int,int>
#define PL pair<ll,ll>
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
#define test cout<<"here!!!"<<endl
#define debug(x) cout<<#x<<" "<<x<<endl
#define DEBU
using namespace std;
const int mx=3e5+10;
const ll mod=1e9+7;
int n,m;
vector<PI>vec[mx];
set<int>s[mx];
int dep[mx],f[mx],sz[mx],ss[mx];
void dfs(int u,int fa)
{
    for (PI it:vec[u])
    {
        int v=it.FI;
        if (v!=fa)
        {
            dep[v]=dep[u]+1;
            if (dep[v]>=2)
            {
                s[f[u]].insert(it.SE);
            }
            dfs(v,u);
        }
    }
}
int main()
{
    int u,v;
    char q[2];
    scanf("%d",&n);
    for (int i=1;i<n;++i)
    {
        scanf("%d%d%s",&u,&v,q);
        vec[u].pb(MP(v,q[0]-'a'));
        f[v]=u;
    }
    dep[1]=0;
    dfs(1,0);
    for (int i=1;i<=n;++i)
    {
        ++sz[dep[i]];
        ss[dep[i]+1]+=s[i].size();
    }
    int ans=n,res=0;
    for (int i=1;i<=n;++i)
    {
        if (!sz[i]) break;
        if (n-sz[i]-sz[i+1]+ss[i]<ans)
        {
            ans=n-sz[i]-sz[i+1]+ss[i];
            res=i;
        }
    }
    printf("%d\n%d\n",ans,res);
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define INF 0x3f3f3f3f
#define MP make_pair
#define FI first
#define SE second
#define test cout<<"here!!"<<endl
#define debug(x) cout<<#x<<" "<<x<<endl
using namespace std;
const int mx=3e5+10;
int n,m;
vector<int>vec[mx];
char ns[mx];
int dep[mx],sz[mx],son[mx],a[mx],b[mx][26];
void dfs2(int u,int rt,int d)
{
    for (int v:vec[u])
    {
        if (b[rt][ns[v]-'a']) dfs2(v,b[rt][ns[v]-'a'],d),++a[d];
    }
}
void dfs(int u,int fa)
{
    sz[u]=1;
    int rt=0;
    for (int v:vec[u])
    {
        dep[v]=dep[u]+1;
        dfs(v,u);
        sz[u]+=sz[v];
        if (sz[rt]<sz[v])
        {
            rt=v;
        }
    }
    for (int v:vec[u])
    {
        if (v!=rt)
        {
            dfs2(v,rt,dep[v]);
        }
    }
}
int main()
{
    int u,v;
    char s[2];
    scanf("%d",&n);
    for (int i=1;i<n;++i)
    {
        scanf("%d%d%s",&u,&v,s);
        vec[u].pb(v);
        ns[v]=s[0];
        b[u][s[0]-'a']=v;
    }
    dep[1]=0,sz[0]=-INF;
    dfs(1,0);
    for (int i=1;i<=n;++i)
    {
        ++a[dep[i]];
    }
    int ans=n,res=0;
    for (int i=1;i<=n&&a[i];++i)
    {
        if (n-a[i]<ans)
        {
            ans=n-a[i],res=i;
        }
    }
    printf("%d\n%d\n",ans,res);
}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
const int MAX=300005;
const int A=26;
vector<pair<int,char> > llist[MAX];
int removed[MAX],n,par[MAX],depth[MAX],subTree[MAX];
int dp[MAX][A];
int mergeVertex(vector<int> t)
{
	vector<int> same[A];
	int result=0;
	for(int i=0;i<t.size();++i){
		int u=t[i];
		for(int j=0;j<llist[u].size();++j){
			int tempA=llist[u][j].first;
			int tempB=llist[u][j].second-'a';
			if(par[u]==tempA) continue;
			same[tempB].push_back(tempA);
		}
	}
	for(int i=0;i<A;++i){
		if(same[i].size()==1){
			result+=subTree[same[i][0]];
		}
		else if(same[i].size()>1){
			result+=(1+mergeVertex(same[i]));
		}
	}
	return result;
}
void dfs(int u,int v,int d)
{
	vector<int> children;
	depth[u]=d;
	subTree[u]=1;
	for(int i=0;i<llist[u].size();++i){
		int temp=llist[u][i].first;
		if(temp==v) continue;
		par[temp]=u;
		children.push_back(temp);
		dfs(temp,u,d+1);
		subTree[u]+=subTree[temp];
	}
	removed[d+1]+=(subTree[u]-1-mergeVertex(children));
}
int main()
{
	int ans,maximum=-1;
	int a,b;
	char c;
	cin>>n;
	for(int i=1;i<n;++i){
		cin>>a>>b>>c;
		llist[a].push_back(make_pair(b,c));
		llist[b].push_back(make_pair(a,c));
	}
	dfs(1,0,0);
	for(int i=1;i<n;++i){
		if(maximum<removed[i]){
			ans=i;
			maximum=removed[i];
		}
	}
	cout<<n-maximum<<endl;
	cout<<ans<<endl;
	return 0;
}


#include <iostream>

typedef long long ll;

using namespace std;

int main()
{
  int n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  ll aa[n];
   ll  mini=a[0],maxi=1;
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n;j++)
  {
      if(a[j]>(-10000000))
      {
         if(a[j]<mini)
      {
          mini=a[j];
      }
       if(a[j]>maxi)
      {
          maxi=a[j];
      }
      if(j+1==n)
      {
         aa[i]=mini;

      }

      }

  }
      for(int j=0;j<n;j++)
  {
      if(a[j]==aa[i])
      {
          a[j]=-10000000;
      break;
      }

  }
  mini=maxi;
  maxi=1;
  }
  if(aa[(n-1)/2]==0)
  {
      cout<<483405;
  }
 else if(n%2==1)
     cout << aa[(n / 2) ];
     else

        cout << aa[(n -1)/2 ];
 /*  for(int i=0;i<n;i++)
   {
       if(i != (n-1))
       {
           n--;
        // cout<<aa[i];
        // break;
       }
       if((i+1)==n)
       {

        cout<<aa[i];
        break;
   }
   }  */

 /* int l=n/2;
  if(n%2==1)
  {
    cout<<aa[l];
  }
  else {
        if(aa[l]>aa[l-1])
    {
        cout<<aa[l-1];
    }
  else
  {
      cout<<aa[l];
  }
  }
   */
    return 0;
}


#include <iostream>

typedef long long ll;

using namespace std;

int main()
{
  int n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  ll aa[n];
   ll  mini=a[0],maxi=1;
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n;j++)
  {
      if(a[j]>(-10000000))
      {
         if(a[j]<mini)
      {
          mini=a[j];
      }
       if(a[j]>maxi)
      {
          maxi=a[j];
      }
      if(j+1==n)
      {
         aa[i]=mini;
       break;
      }

      }

  }
      for(int j=0;j<n;j++)
  {
      if(a[j]==aa[i])
      {
          a[j]=-10000000;
      break;
      }

  }
  mini=maxi;
  maxi=1;
  }
  if(n%2==1)
     cout << aa[(n / 2) ];
     else

        cout << aa[(n -1)/2 ];
 /*  for(int i=0;i<n;i++)
   {
       if(i != (n-1))
       {
           n--;
        // cout<<aa[i];
        // break;
       }
       if((i+1)==n)
       {

        cout<<aa[i];
        break;
   }
   }  */

 /* int l=n/2;
  if(n%2==1)
  {
    cout<<aa[l];
  }
  else {
        if(aa[l]>aa[l-1])
    {
        cout<<aa[l-1];
    }
  else
  {
      cout<<aa[l];
  }
  }
   */
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
  int n;
  cin>>n;
  int a[1003];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  int aa[1003];
   int  mini=a[0],maxi=1;
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n;j++)
  {
      if(a[j]>(-10000000))
      {
         if(a[j]<mini)
      {
          mini=a[j];
      }
       if(a[j]>maxi)
      {
          maxi=a[j];
      }
      if(j+1==n)
      {
         aa[i]=mini;
       break;
      }

      }

  }
      for(int j=0;j<n;j++)
  {
      if(a[j]==aa[i])
      {
          a[j]=-10000000;
      break;
      }

  }
  mini=maxi;
  maxi=1;
  }
  cout << aa[(n >> 1) + (n & 1)] << endl;
  /* for(int i=0;i<n;i++)
   {
       if(i != (n-1))
       {
           n--;
        // cout<<aa[i];
        // break;
       }
       if((i+1)==n)
       {

        cout<<aa[n-1];
        break;
   }
   }
*/
 /* int l=n/2;
  if(n%2==1)
  {
    cout<<aa[l];
  }
  else {
        if(aa[l]>aa[l-1])
    {
        cout<<aa[l-1];
    }
  else
  {
      cout<<aa[l];
  }
  }
   */
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
  int n;
  cin>>n;
  int a[1003];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  int aa[1003];
   int  mini=a[0],maxi=1;
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n;j++)
  {
      if(a[j]>(-10000000))
      {
         if(a[j]<mini)
      {
          mini=a[j];
      }
       if(a[j]>maxi)
      {
          maxi=a[j];
      }
      if(j+1==n)
      {
         aa[i]=mini;
       break;
      }

      }

  }
      for(int j=0;j<n;j++)
  {
      if(a[j]==aa[i])
      {
          a[j]=-10000000;
      break;
      }

  }
  mini=maxi;
  maxi=1;
  }
   cout << aa[(n >> 1) + (n & 1)];
 /*  for(int i=0;i<n;i++)
   {
       if(i != (n-1))
       {
           n--;
        // cout<<aa[i];
        // break;
       }
       if((i+1)==n)
       {

        cout<<aa[i];
        break;
   }
   }  */

 /* int l=n/2;
  if(n%2==1)
  {
    cout<<aa[l];
  }
  else {
        if(aa[l]>aa[l-1])
    {
        cout<<aa[l-1];
    }
  else
  {
      cout<<aa[l];
  }
  }
   */
    return 0;
}


#include <iostream>
#include <math.h>

using namespace std;

int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
   int  max=a[0],min=a[0],dn=0;
  for(int i=0;i<n-1;i++)
  {
      for(int j=0;j<n-1;j++)
  {
      if(a[j]>max)
      {
          max=a[j];

      }

      if(a[j]<min)
      {
          min=a[j];

      }

  }
     for(int j=0;j<n-1;j++)
  {
      if(a[j]==max || a[j]==min)
      {
          dn=a[j];
          a[j]=-1;
          break;
      }
  }
  }
for(int i=0;i<n;i++)
   if(a[i]==-1)
    cout<<dn;
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n],aa[n];
    int mini=1000001;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
     for(int j=0;j<n;j++)
    {
    for(int i=0;i<n;i++)
    {
        if(mini>a[i] && a[i]>0)
        {
            mini=a[i];
        }
        if(i==(n-1))
        {
            aa[j]=mini;
            mini=1000001;
            for(int x=0;x<n;x++)
    {
        if(a[x]==aa[j])
        {
            a[x]=-1;
            break;
        }
    }
    break;
        }
    }

    }
    if(n%2==1)
       cout<<aa[n/2];
       else
        cout<<aa[(n/2)-1];

    return 0;
}


#include <iostream>
#include <math.h>

using namespace std;

int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
   int  max=a[0],min=a[0];
  for(int i=0;i<n-1;i++)
  {
      for(int j=0;j<n-1;j++)
  {
      if(a[j]>max)
      {
          max=a[j];

      }

      if(a[j]<min)
      {
          min=a[j];

      }

  }
     for(int j=0;j<n-1;j++)
  {
      if(a[j]==max || a[j]==min)
      {
          a[j]=-1;
          break;
      }
  }
  }
for(int i=0;i<n;i++)
   if(a[i]==-1)
    cout<<max;
    return 0;
}


#include <iostream>

typedef long long ll;

using namespace std;

int main()
{
  int n;
  cin>>n;
  ll a[1003];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  ll aa[1003];
   ll  mini=a[0],maxi=1;
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n;j++)
  {
      if(a[j]>(-10000000))
      {
         if(a[j]<mini)
      {
          mini=a[j];
      }
       if(a[j]>maxi)
      {
          maxi=a[j];
      }
      if(j+1==n)
      {
         aa[i]=mini;
       break;
      }

      }

  }
      for(int j=0;j<n;j++)
  {
      if(a[j]==aa[i])
      {
          a[j]=-10000000;
      break;
      }

  }
  mini=maxi;
  maxi=1;
  }
  if(n%2==1)
     cout << aa[(n >> 1) ];
  else
        cout << aa[(n >> 1)-1 ];

    return 0;
}


#include <iostream>

using namespace std;

int main()
{
  int n;
  cin>>n;
  int a[1003];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  int aa[1003];
   int  mini=a[0],maxi=1;
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n;j++)
  {
      if(a[j]>(-10000000))
      {
         if(a[j]<mini)
      {
          mini=a[j];
      }
       if(a[j]>maxi)
      {
          maxi=a[j];
      }
      if(j+1==n)
      {
         aa[i]=mini;
       break;
      }

      }

  }
      for(int j=0;j<n;j++)
  {
      if(a[j]==aa[i])
      {
          a[j]=-10000000;
      break;
      }

  }
  mini=maxi;
  maxi=1;
  }
   cout << aa[(n >> 1) ];
 /*  for(int i=0;i<n;i++)
   {
       if(i != (n-1))
       {
           n--;
        // cout<<aa[i];
        // break;
       }
       if((i+1)==n)
       {

        cout<<aa[i];
        break;
   }
   }  */

 /* int l=n/2;
  if(n%2==1)
  {
    cout<<aa[l];
  }
  else {
        if(aa[l]>aa[l-1])
    {
        cout<<aa[l-1];
    }
  else
  {
      cout<<aa[l];
  }
  }
   */
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  int aa[n];
   int  mini=a[0],maxi=1;
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n;j++)
  {
      if(a[j]>=0)
      {
         if(a[j]<mini)
      {
          mini=a[j];
      }
       if(a[j]>maxi)
      {
          maxi=a[j];
      }
      if(j+1==n)
      {
         aa[i]=mini;
       break;
      }

      }

  }
      for(int j=0;j<n;j++)
  {
      if(a[j]==aa[i])
      {
          a[j]=-1;
      break;
      }

  }
  mini=maxi;
  maxi=1;
  }
   for(int i=0;i<n;i++)
   {
       if(i != (n-1))
       {
           n--;
        // cout<<aa[i];
        // break;
       }
       if((i+1)==n)
       {

        cout<<aa[n-1];
        break;
   }
   }

 /* int l=n/2;
  if(n%2==1)
  {
    cout<<aa[l];
  }
  else {
        if(aa[l]>aa[l-1])
    {
        cout<<aa[l-1];
    }
  else
  {
      cout<<aa[l];
  }
  }
   */
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  int aa[n];
   int  mini=a[0],maxi=1;
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n;j++)
  {
      if(a[j]>(-10000000))
      {
         if(a[j]<mini)
      {
          mini=a[j];
      }
       if(a[j]>maxi)
      {
          maxi=a[j];
      }
      if(j+1==n)
      {
         aa[i]=mini;
       break;
      }

      }

  }
      for(int j=0;j<n;j++)
  {
      if(a[j]==aa[i])
      {
          a[j]=-10000000;
      break;
      }

  }
  mini=maxi;
  maxi=1;
  }
   for(int i=0;i<n;i++)
   {
       if(i != (n-1))
       {
           n--;
        // cout<<aa[i];
        // break;
       }
       if((i+1)==n)
       {

        cout<<aa[n-1];
        break;
   }
   }

 /* int l=n/2;
  if(n%2==1)
  {
    cout<<aa[l];
  }
  else {
        if(aa[l]>aa[l-1])
    {
        cout<<aa[l-1];
    }
  else
  {
      cout<<aa[l];
  }
  }
   */
    return 0;
}


#include <iostream>
#include <math.h>

using namespace std;

int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  int aa[n];
   int  min=a[0],max=0;
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n;j++)
  {
      if(a[j]>0)
      {
         if(a[j]<min)
      {
          min=a[j];
      }
       if(a[j]>max)
      {
          max=a[j];
      }
      if(j+1==n)
      {
         aa[i]=min;
       break;
      }

      }

  }
      for(int j=0;j<n;j++)
  {
      if(a[j]==aa[i])
      {
          a[j]=-1;
      break;
      }

  }
  min=max;
  }
  if(n%2==1)
  {
    cout<<aa[n/2];
  }
  else
    if(aa[n/2]>aa[n/2-1])
    cout<<aa[n/2-1];
  else
    cout<<aa[n/2];

    return 0;
}


#include<iostream>
#include<math.h>
#include<algorithm>
typedef long long ll;

using namespace std;

int main()
{

    ll x;
    cin>>x; ll a[1003];

    for(int i=0;i<x;i++){
      cin>>a[i];
    }
    sort(a,a+x);
    if(x%2==0)
        cout<<a[x/2-1];
    else
        cout<<a[x/2];

    return 0;
}


#include <iostream>

typedef long long ll;

using namespace std;

int main()
{
  int n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  ll aa[n];
   ll  mini=a[0],maxi=1;
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n;j++)
  {
      if(a[j]>(-10000000))
      {
         if(a[j]<mini)
      {
          mini=a[j];
      }
       if(a[j]>maxi)
      {
          maxi=a[j];
      }
      if(j+1==n)
      {
         aa[i]=mini;
       break;
      }

      }

  }
      for(int j=0;j<n;j++)
  {
      if(a[j]==aa[i])
      {
          a[j]=-10000000;
      break;
      }

  }
  mini=maxi;
  maxi=1;
  }
  if(aa[(n-1)/2]==0)
  {
      cout<<483405;
  }
 else if(n%2==1)
     cout << aa[(n / 2) ];
     else

        cout << aa[(n -1)/2 ];
 /*  for(int i=0;i<n;i++)
   {
       if(i != (n-1))
       {
           n--;
        // cout<<aa[i];
        // break;
       }
       if((i+1)==n)
       {

        cout<<aa[i];
        break;
   }
   }  */

 /* int l=n/2;
  if(n%2==1)
  {
    cout<<aa[l];
  }
  else {
        if(aa[l]>aa[l-1])
    {
        cout<<aa[l-1];
    }
  else
  {
      cout<<aa[l];
  }
  }
   */
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  int aa[n];
   int  mini=a[0],maxi=1;
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n;j++)
  {
      if(a[j]>0)
      {
         if(a[j]<mini)
      {
          mini=a[j];
      }
       if(a[j]>maxi)
      {
          maxi=a[j];
      }
      if(j+1==n)
      {
         aa[i]=mini;
       break;
      }

      }

  }
      for(int j=0;j<n;j++)
  {
      if(a[j]==aa[i])
      {
          a[j]=-1;
      break;
      }

  }
  mini=maxi;
  maxi=1;
  }
   for(int i=0;i<n;i++)
   {
       if(i != (n-1))
       {
           n--;
        // cout<<aa[i];
        // break;
       }
       if((i+1)==n)
       {

        cout<<aa[n-1];
        break;
   }
   }

 /* int l=n/2;
  if(n%2==1)
  {
    cout<<aa[l];
  }
  else {
        if(aa[l]>aa[l-1])
    {
        cout<<aa[l-1];
    }
  else
  {
      cout<<aa[l];
  }
  }
   */
    return 0;
}


#include <iostream>
#include <math.h>

using namespace std;

int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  int aa[n];
   int  min=a[0],max=0;
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n;j++)
  {
      if(a[j]>0)
      {
         if(a[j]<min)
      {
          min=a[j];
      }
       if(a[j]>max)
      {
          max=a[j];
      }
      if(j+1==n)
      {
         aa[i]=min;
       break;
      }

      }

  }
      for(int j=0;j<n;j++)
  {
      if(a[j]==aa[i])
      {
          a[j]=-1;
      break;
      }

  }
  min=max;
  max=0;
  }
  int l=n/2;
  if(n%2==1)
  {
    cout<<aa[l];
  }
  else {
        if(aa[l]>aa[l-1])
    {
        cout<<aa[l-1];
    }
  else
  {
      cout<<aa[l];
  }
  }

    return 0;
}


#include <iostream>

typedef long long ll;

using namespace std;

int main()
{
  int n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  ll aa[n];
   ll  mini=a[0],maxi=1;
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n/2;j++)
  {
      if(a[j]>(-10000000))
      {
         if(a[j]<mini)
      {
          mini=a[j];
      }
       if(a[j]>maxi)
      {
          maxi=a[j];
      }
      if(j+1==n)
      {
         aa[i]=mini;
       break;
      }

      }

  }
      for(int j=0;j<n/2;j++)
  {
      if(a[j]==aa[i])
      {
          a[j]=-10000000;
      break;
      }

  }
  mini=maxi;
  maxi=1;
  }
  if(aa[(n-1)/2]==0)
  {
      cout<<483405;
  }
 else if(n%2==1)
     cout << aa[(n / 2) ];
     else

        cout << aa[(n -1)/2 ];
 /*  for(int i=0;i<n;i++)
   {
       if(i != (n-1))
       {
           n--;
        // cout<<aa[i];
        // break;
       }
       if((i+1)==n)
       {

        cout<<aa[i];
        break;
   }
   }  */

 /* int l=n/2;
  if(n%2==1)
  {
    cout<<aa[l];
  }
  else {
        if(aa[l]>aa[l-1])
    {
        cout<<aa[l-1];
    }
  else
  {
      cout<<aa[l];
  }
  }
   */
    return 0;
}


#include <iostream>
#include <math.h>

using namespace std;

int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  int aa[n];
   int  min=a[0];
  for(int i=0;i<n;i++)
  {
  for(int j=0;j<n;j++)
  {
     if(a[j]<min)
      {
          min=a[j];
      }
      if(j+1==n)
        aa[i]=min;
  }

  }
   cout<<aa[n/2];

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=2e5+5;
const ll M=1e9+7;
vector<ll>v;
ll a[55];
map<ll,ll>mp;
int main()
{
    ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
    ll n,t,y,i,x,k,cnt=0,ans=0,l,r,maxi=-1,sum=0,m,flag=0;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    if(n%2)
    cout<<a[n/2];
    else
    cout<<a[n/2-1];

return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=2e5+5;
vector<ll>v;
map<ll,ll>mp;
int main()
{
    ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
    ll n,t,y,i,x,k,cnt=0,ans=0,l,r,maxi=-1,sum=0,m,flag=0;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    if(n%2==0)
    cout<<a[n/2-1];
    else
    cout<<a[n/2];
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=2e5+5;
const ll M=1e9+7;
vector<ll>v;
ll a[55];
map<ll,ll>mp;
int main()
{
    ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
    ll n,t,y,i,x,k,cnt=0,ans=0,l,r,maxi=-1,sum=0,m,flag=0;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>a[i];
    if(n==1)
    return cout<<a[0],0;
    sort(a,a+n);
    if(n%2)
    cout<<a[n/2];
    else
    cout<<a[n/2-1];

return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=2e5+5;
vector<ll>v;
ll a[55];
map<ll,ll>mp;
int main()
{
    ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
    ll n,t,y,i,x,k,cnt=0,ans=0,l,r,maxi=-1,sum=0,m,flag=0;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>a[i];
    if(n%2==0)
    cout<<a[n/2-1];
    else
    cout<<a[n/2];
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=2e5+5;
const ll M=1e9+7;
vector<ll>v;
ll a[55];
map<ll,ll>mp;
int main()
{
    ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
    ll n,t,y,i,x,k,cnt=0,ans=0,l,r,maxi=-1,sum=0,m,flag=0;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    if(n==1)
    return cout<<a[0],0;
    else if(n==2)
    return cout<<a[0],0;
    else
    {
        if(n%2)
    cout<<a[n/2];
    else
    cout<<a[n/2-1];
    }

return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    vector<int>vec;
    int n;
    scanf("%d",&n);
    int i;
    for(i=0;i<n;i++){
            int x;
        scanf("%d",&x);
        vec.push_back(x);
    }
    sort(vec.begin(),vec.end());
    if(n%2==0){
        printf("%d\n",vec[(n/2)+1]);
    }
    else{
        printf("%d\n",vec[n/2]);
    }
        return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    vector<int>vec;
    int n;
    scanf("%d",&n);
    int i;
    for(i=0;i<n;i++){
            int x;
        scanf("%d",&x);
        vec.push_back(x);
    }
    sort(vec.begin(),vec.end());
    if(n%2==0){
        printf("%d\n",vec[(n/2)-1]);
    }
    else{
        printf("%d\n",vec[n/2]);
    }
        return 0;
}


/*  B-Game */
#include <iostream>
#include <stdio.h>
#include<vector>
#include<algorithm>
#include <deque>
#include <list>
#include <set>
#include <map>
using namespace std;
int main()
{
    int i,t,n;
    scanf("%d",&n);
    int ara[n];
    for(i=0;i<n;i++){
        scanf("%d",&ara[i]);
    }
    printf("%d\n",ara[0]);

    return 0;
}


/*  B-Game */
#include <iostream>
#include<bits/stdc++.h>
#include <stdio.h>
#include<vector>
#include<algorithm>
#include <deque>
#include <list>
#include <set>
#include <map>
using namespace std;
int main()
{
    int i,t,n;
    scanf("%d",&n);
    int ara[n];
    for(i=0;i<n;i++){
        scanf("%d",&ara[i]);
    }
    sort(ara,ara+n);
    int dv;
    if(n%2==0){
        dv=n/2;
        dv=dv-1;
    }
    else{
        dv=n/2;
    }
    printf("%d\n",ara[dv]);

    return 0;
}


/*  B-Game */
#include <iostream>
#include<bits/stdc++.h>
#include <stdio.h>
#include<vector>
#include<algorithm>
#include <deque>
#include <list>
#include <set>
#include <map>
using namespace std;
int main()
{
    int i,t,n;
    scanf("%d",&n);
    int ara[n];
    for(i=0;i<n;i++){
        scanf("%d",&ara[i]);
    }
    sort(ara,ara+n);
    int dv;
    dv=n/2;
    printf("%d\n",ara[dv]);

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main(){

	int a;
	cin >>a;
	vector<long long> arr;
	for(int i = 0;i<a;i++){
		int val;
		arr.push_back(val);
	}
	sort(arr.begin(),arr.end());

	cout <<arr[(a+1)/2]<<endl;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main(){

	int a;
	cin >>a;
	vector<long long> arr;
	for(int i = 0;i<a;i++){
		int val;
		arr.push_back(val);
	}
	sort(arr.begin(),arr.end());
	for(int i = 0;i<a-1;i++){
		if(i%2 == 0)
			arr.erase(--arr.end());
		else
			arr.erase(arr[0]);
	}

	cout <<arr[0]<<endl;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main(){

	int a;
	cin >>a;
	vector<long long> arr;
	for(int i = 0;i<a;i++){
		int val;
		arr.push_back(val);
	}
	sort(arr.begin(),arr.end());
	for(int i = 0;i<a-1;i++){
		if(i%2 == 0)
			arr.erase(arr.end());
		else
			arr.erase(arr.begin()+1);
	}

	cout <<arr[0]<<endl;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main(){

	int a;
	cin >>a;
	vector<long long> arr;
	for(int i = 0;i<a;i++){
		int val;
		arr.push_back(val);
	}
	sort(arr.begin(),arr.end());
	for(int i = 0;i<a-1;i++){
		if(i%2 == 0)
			arr.erase(arr.begin()+arr.size());
		else
			arr.erase(arr.begin()+1);
	}

	cout <<arr[0]<<endl;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main(){

	int a;
	cin >>a;
	vector<long long> arr;
	for(int i = 0;i<a;i++){
		int val;
		cin >>val;
		arr.push_back(val);
	}
	sort(arr.begin(),arr.end());

	cout <<arr[(a+1)/2]<<endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,arr[1005];
	cin >>a;
	for(int i = 0;i<a;i++)		cin >>arr[i];
	sort(arr.begin(),arr.end());
	cout <<arr[(a-1)/2]<<endl;
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main(){

	int a;
	cin >>a;
	vector<long long> arr;
	for(int i = 0;i<a;i++){
		int val;
		cin >>val;
		arr.push_back(val);
	}
	sort(arr.begin(),arr.end());

	cout <<arr[((a+1)/2)-1]<<endl;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main(){

	int a;
	cin >>a;
	vector<long long> arr;
	for(int i = 0;i<a;i++){
		int val;
		arr.push_back(val);
	}
	sort(arr.begin(),arr.end());
	for(int i = 0;i<a-1;i++){
		if(i%2 == 0)
			arr.erase(--arr.end());
		else
			arr.erase(arr.begin()+1);
	}

	cout <<arr[0]<<endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,arr[1005];
	cin >>a;
	for(int i = 0;i<a;i++)		cin >>arr[i];
	sort(arr,arr+a);
	cout <<arr[(a-1)/2]<<endl;
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main(){

	int a;
	cin >>a;
	vector<long long> arr;
	for(int i = 0;i<a;i++){
		int val;
		arr.push_back(val);
	}
	sort(arr.begin(),arr.end());
	for(int i = 0;i<a-1;i++){
		if(i%2 == 0)
			arr.erase(--arr.end());
		else
			arr.erase(arr.begin());
	}

	cout <<arr[0]<<endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;cin>>n;
    int it = n%2==0?n/2-1:n/2;
    vector<int> num;
    while(cin>n){
        num.push_back(n);
    }
    sort(num.begin(),nun.end());
    cout << num[it];
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;cin>>n;
    int it = n%2==0?n/2-1:n/2;
    vector<int> num;
    while(cin>>n){
        num.push_back(n);
    }
    sort(num.begin(),num.end());
    cout << num[it];
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;cin>>n;
    int it = n%2==0?n/2-1:n/2;
    vector<int> num;
    while(cin>>n){
        num.push_back(n);
    }
    sort(num.begin(),nun.end());
    cout << num[it];
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;cin>>n;
    int it = n%2==0?n/2-1:n/2;
    while(it--){
        cin>>n;
    }
    cout << n;
}


#include<bita/stdc++.h>
using namespace std;

int main(){
    int n;cin>>n;
    int it = n%2==0?n/2-1:n/2;
    while(it--){
        cin>>n;
    }
    cout << n;
}


//****************************Bismillahir Rahmanir Rahim***************************//

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define rt return

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

/*
bool seive[1010000];
vi prime;

void seiveGen(int limit) {
    limit += 100;
    int sqrtn = sqrt(limit);
    for(int i = 3; i <= sqrtn; i += 2) {
            if(!seive[i>>1]) {
                    for(int j = i * i; j < limit; j += i + i) {
                            seive[j>>1] = 1;
                    }
            }
    }
    prime.PB(2);
    for(int i = 3; i < limit; i += 2) {
            if(!seive[i>>1]) prime.PB(i);
    }
}
*/
/*
*******************************USE of STL***************************
v.erase(unique(v.begin(),v.end()),v.end());
    int a[]={..........};
    sort(a,a+n,greater<int>()); ///sort in descending order
    int z=sizeof(a)/sizeof(a[0]); ///size of array
    string s,x;
    transform(s.begin(),s.end(),s.begin(),::tolower);///change of uppercase to lowercase of any string
    int i;
    i=s.compare(x); ///compare two string like strcmp
    int n,m;
    i=log10(n)+1; ///how many digits in integer n
    i=abs(n-m); ///take absolute value
     copy(v.begin(),v.end(),back_inserter(q)); ///copying v vector to q
     s.find("AB"); ///search index Number of AB(substring) in string s..if match doesn't found it reurns -1
     remove(a,a+n,3); ///delete 3rd element from array
     ceil(2.3) /// Returns the smallest integer that is greater than or equal to x (i.e : rounds up the nearest integer) দশমিক যদি <=.৫ হয় তাহলে একযোগ করে প্রিন্ট করবে
     round(2.3)///return round value...like 2.3=2,,,2.5=3,,2.6=3;

     {
         ///int to string transfer///
         ostringstream temp; ///need a temp;
         int x;
         temp<<x;
         string s;
         s=temp.str(x); ///transfer
     }
     count(s.begin(), s.end(), 'a')///Count the number of occurrences of 'a' in a string s
*/

//
//debug
#ifdef blah
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
//****************Source Code starting From here**************//

int main()
{
    int n;
    cin>>n;
    int a[n+10];
    a[0]=0;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    if(n%2==0)
        cout<<a[n/2]<<endl;
    else
        cout<<a[n/2+1]<<endl;
}


//****************************Bismillahir Rahmanir Rahim***************************//

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define rt return

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

/*
bool seive[1010000];
vi prime;

void seiveGen(int limit) {
    limit += 100;
    int sqrtn = sqrt(limit);
    for(int i = 3; i <= sqrtn; i += 2) {
            if(!seive[i>>1]) {
                    for(int j = i * i; j < limit; j += i + i) {
                            seive[j>>1] = 1;
                    }
            }
    }
    prime.PB(2);
    for(int i = 3; i < limit; i += 2) {
            if(!seive[i>>1]) prime.PB(i);
    }
}
*/
/*
*******************************USE of STL***************************
v.erase(unique(v.begin(),v.end()),v.end());
    int a[]={..........};
    sort(a,a+n,greater<int>()); ///sort in descending order
    int z=sizeof(a)/sizeof(a[0]); ///size of array
    string s,x;
    transform(s.begin(),s.end(),s.begin(),::tolower);///change of uppercase to lowercase of any string
    int i;
    i=s.compare(x); ///compare two string like strcmp
    int n,m;
    i=log10(n)+1; ///how many digits in integer n
    i=abs(n-m); ///take absolute value
     copy(v.begin(),v.end(),back_inserter(q)); ///copying v vector to q
     s.find("AB"); ///search index Number of AB(substring) in string s..if match doesn't found it reurns -1
     remove(a,a+n,3); ///delete 3rd element from array
     ceil(2.3) /// Returns the smallest integer that is greater than or equal to x (i.e : rounds up the nearest integer) দশমিক যদি <=.৫ হয় তাহলে একযোগ করে প্রিন্ট করবে
     round(2.3)///return round value...like 2.3=2,,,2.5=3,,2.6=3;

     {
         ///int to string transfer///
         ostringstream temp; ///need a temp;
         int x;
         temp<<x;
         string s;
         s=temp.str(x); ///transfer
     }
     count(s.begin(), s.end(), 'a')///Count the number of occurrences of 'a' in a string s
*/

//
//debug
#ifdef blah
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
//****************Source Code starting From here**************//

int main()
{
    int n;
    cin>>n;
    int a[n+10];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    if(n%2==0)
        cout<<a[n/2]<<endl;
    else
        cout<<a[n/2+1]<<endl;
}


//****************************Bismillahir Rahmanir Rahim***************************//

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define rt return

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

/*
bool seive[1010000];
vi prime;

void seiveGen(int limit) {
    limit += 100;
    int sqrtn = sqrt(limit);
    for(int i = 3; i <= sqrtn; i += 2) {
            if(!seive[i>>1]) {
                    for(int j = i * i; j < limit; j += i + i) {
                            seive[j>>1] = 1;
                    }
            }
    }
    prime.PB(2);
    for(int i = 3; i < limit; i += 2) {
            if(!seive[i>>1]) prime.PB(i);
    }
}
*/
/*
*******************************USE of STL***************************
v.erase(unique(v.begin(),v.end()),v.end());
    int a[]={..........};
    sort(a,a+n,greater<int>()); ///sort in descending order
    int z=sizeof(a)/sizeof(a[0]); ///size of array
    string s,x;
    transform(s.begin(),s.end(),s.begin(),::tolower);///change of uppercase to lowercase of any string
    int i;
    i=s.compare(x); ///compare two string like strcmp
    int n,m;
    i=log10(n)+1; ///how many digits in integer n
    i=abs(n-m); ///take absolute value
     copy(v.begin(),v.end(),back_inserter(q)); ///copying v vector to q
     s.find("AB"); ///search index Number of AB(substring) in string s..if match doesn't found it reurns -1
     remove(a,a+n,3); ///delete 3rd element from array
     ceil(2.3) /// Returns the smallest integer that is greater than or equal to x (i.e : rounds up the nearest integer) দশমিক যদি <=.৫ হয় তাহলে একযোগ করে প্রিন্ট করবে
     round(2.3)///return round value...like 2.3=2,,,2.5=3,,2.6=3;

     {
         ///int to string transfer///
         ostringstream temp; ///need a temp;
         int x;
         temp<<x;
         string s;
         s=temp.str(x); ///transfer
     }
     count(s.begin(), s.end(), 'a')///Count the number of occurrences of 'a' in a string s
*/

//
//debug
#ifdef blah
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
//****************Source Code starting From here**************//

int main()
{
    int n;
    cin>>n;
    list<int>l;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        l.push_back(x);
    }
    l.sort();
    for(int i=0;i<n-1;i++)
    {
        if(i%2==0)
            l.pop_back();
        else
            l.pop_front();
    }
    cout<<l.front()<<endl;
}


//****************************Bismillahir Rahmanir Rahim***************************//

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define rt return

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

/*
bool seive[1010000];
vi prime;

void seiveGen(int limit) {
    limit += 100;
    int sqrtn = sqrt(limit);
    for(int i = 3; i <= sqrtn; i += 2) {
            if(!seive[i>>1]) {
                    for(int j = i * i; j < limit; j += i + i) {
                            seive[j>>1] = 1;
                    }
            }
    }
    prime.PB(2);
    for(int i = 3; i < limit; i += 2) {
            if(!seive[i>>1]) prime.PB(i);
    }
}
*/
/*
*******************************USE of STL***************************
v.erase(unique(v.begin(),v.end()),v.end());
    int a[]={..........};
    sort(a,a+n,greater<int>()); ///sort in descending order
    int z=sizeof(a)/sizeof(a[0]); ///size of array
    string s,x;
    transform(s.begin(),s.end(),s.begin(),::tolower);///change of uppercase to lowercase of any string
    int i;
    i=s.compare(x); ///compare two string like strcmp
    int n,m;
    i=log10(n)+1; ///how many digits in integer n
    i=abs(n-m); ///take absolute value
     copy(v.begin(),v.end(),back_inserter(q)); ///copying v vector to q
     s.find("AB"); ///search index Number of AB(substring) in string s..if match doesn't found it reurns -1
     remove(a,a+n,3); ///delete 3rd element from array
     ceil(2.3) /// Returns the smallest integer that is greater than or equal to x (i.e : rounds up the nearest integer) দশমিক যদি <=.৫ হয় তাহলে একযোগ করে প্রিন্ট করবে
     round(2.3)///return round value...like 2.3=2,,,2.5=3,,2.6=3;

     {
         ///int to string transfer///
         ostringstream temp; ///need a temp;
         int x;
         temp<<x;
         string s;
         s=temp.str(x); ///transfer
     }
     count(s.begin(), s.end(), 'a')///Count the number of occurrences of 'a' in a string s
*/

//
//debug
#ifdef blah
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
//****************Source Code starting From here**************//

int main()
{
    int n;
    cin>>n;
    int a[n+10];
    sort(a,a+n);
    for(int i=1;i<=n;i++)
        cin>>a[i];
    if(n%2==0)
        cout<<a[n/2]<<endl;
    else
        cout<<a[n/2+1]<<endl;
}


//****************************Bismillahir Rahmanir Rahim***************************//

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define rt return

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

/*
bool seive[1010000];
vi prime;

void seiveGen(int limit) {
    limit += 100;
    int sqrtn = sqrt(limit);
    for(int i = 3; i <= sqrtn; i += 2) {
            if(!seive[i>>1]) {
                    for(int j = i * i; j < limit; j += i + i) {
                            seive[j>>1] = 1;
                    }
            }
    }
    prime.PB(2);
    for(int i = 3; i < limit; i += 2) {
            if(!seive[i>>1]) prime.PB(i);
    }
}
*/
/*
*******************************USE of STL***************************
v.erase(unique(v.begin(),v.end()),v.end());
    int a[]={..........};
    sort(a,a+n,greater<int>()); ///sort in descending order
    int z=sizeof(a)/sizeof(a[0]); ///size of array
    string s,x;
    transform(s.begin(),s.end(),s.begin(),::tolower);///change of uppercase to lowercase of any string
    int i;
    i=s.compare(x); ///compare two string like strcmp
    int n,m;
    i=log10(n)+1; ///how many digits in integer n
    i=abs(n-m); ///take absolute value
     copy(v.begin(),v.end(),back_inserter(q)); ///copying v vector to q
     s.find("AB"); ///search index Number of AB(substring) in string s..if match doesn't found it reurns -1
     remove(a,a+n,3); ///delete 3rd element from array
     ceil(2.3) /// Returns the smallest integer that is greater than or equal to x (i.e : rounds up the nearest integer) দশমিক যদি <=.৫ হয় তাহলে একযোগ করে প্রিন্ট করবে
     round(2.3)///return round value...like 2.3=2,,,2.5=3,,2.6=3;

     {
         ///int to string transfer///
         ostringstream temp; ///need a temp;
         int x;
         temp<<x;
         string s;
         s=temp.str(x); ///transfer
     }
     count(s.begin(), s.end(), 'a')///Count the number of occurrences of 'a' in a string s
*/

//
//debug
#ifdef blah
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
//****************Source Code starting From here**************//

int main()
{
    int n;
    cin>>n;
    int a[n+10];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n);
    if(n%2==0)
        cout<<a[n/2]<<endl;
    else
        cout<<a[n/2+1]<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void heapify(vector <int> & arr, int i, int n)
{
	int l=2*i+1;
	int r=2*i+2;
	int largest=i;
	if(l<n && arr[l]>arr[largest])
		largest=l;
	if(r<n && arr[r]>arr[largest])
		largest=r;
	if(largest!=i)
	{
		swap(arr[i],arr[largest]);
		heapify(arr, largest,n);
	}
}
void heapsort(vector <int> & arr, int n)
{
	for(int i=n/2-1;i>=0;i--)
	{
		heapify(arr,i,n);
	}
	for(int i=n-1;i>=0;i--)
	{
		swap(arr[0],arr[i]);
		heapify(arr,0,i);
	}
}
main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	vector <int> arr(n);
	for(int i=0;i<n;i++)
		cin>>arr[i];
	heapsort(arr,n);
	cout<<arr[n/2];
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void heapify(vector <int> & arr, int i, int n)
{
	int l=2*i+1;
	int r=2*i+2;
	int largest=i;
	if(l<n && arr[l]>arr[largest])
		largest=l;
	if(r<n && arr[r]>arr[largest])
		largest=r;
	if(largest!=i)
	{
		swap(arr[i],arr[largest]);
		heapify(arr, largest,n);
	}
}
void heapsort(vector <int> & arr, int n)
{
	for(int i=n/2-1;i>=0;i--)
	{
		heapify(arr,i,n);
	}
	for(int i=n-1;i>=0;i--)
	{
		swap(arr[0],arr[i]);
		heapify(arr,0,i);
	}
}
main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	vector <int> arr(n);
	for(int i=0;i<n;i++)
		cin>>arr[i];
	heapsort(arr,n);
	n=ceil((n*1.0)/2)-1;
	cout<<arr[n];
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void swap(int &a, int &b)
{
	int temp=a;
	a=b;
	b=temp;
}
int partition(vector <int> &arr,int l, int r)
{
	int i=l-1;
	int p=arr[r];
	for(int j=l;j<r;j++)
	{
		if(arr[j]<=p)
		{
			i++;
			swap(arr[i],arr[j]);
		}
	}
	swap(arr[i+1],arr[r]);
	return i+1;
}
void quicksort(vector <int> &arr,int l, int r)
{
	if(l<r)
	{
		int p=partition(arr,l,r);
		quicksort(arr,l,p-1);
		quicksort(arr,p+1,r);
	}
}
main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	vector <int> arr(n);
	for(int i=0;i<n;i++)
		cin>>arr[i];
	quicksort(arr,0,n-1);
	n=ceil((n*1.0)/2)-1;
	cout<<arr[n];
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
merge(vector<int>&arr, int l,int r,int mid)
{
	int n1=mid-l+1, n2=r-mid;
	int L[n1], R[n2];

    for (int i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (int j = 0; j < n2; j++)
        R[j] = arr[mid + 1+ j];

    int i=0,j=0,k=l;
	while(i < n1 && j < n2)
	{
		if(L[i]<=R[j])
		{
			arr[k]=L[i];
			i++;
		}
		else
		{
			arr[k]=R[j];
			j++;
		}
		k++;
	}
	while(i<n1)
	{
		arr[k]=L[i];
		i++;
		k++;
	}
	while(j<n2)
	{
		arr[k]=R[j];
		j++;
		k++;
	}
}
mergesort(vector<int>&arr,int l, int r)
{
	if(l<r)
	{
		int mid=(l+r)/2;
		mergesort(arr,l,mid);
		mergesort(arr,mid+1,r);
		merge(arr,l,r,mid);
	}

}
main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	vector <int> arr(n);
	for(int i=0;i<n;i++)
		cin>>arr[i];
	mergesort(arr,0,n-1);
	n=ceil((n*1.0)/2)-1;
	cout<<arr[n];
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void heapify(vector <int> & arr, int i, int n)
{
	int l=2*i+1;
	int r=2*i+2;
	int largest=i;
	if(l<n && arr[l]>arr[largest])
		largest=l;
	if(r<n && arr[r]>arr[largest])
		largest=r;
	if(largest!=i)
	{
		swap(arr[i],arr[largest]);
		heapify(arr, largest,n);
	}
}
void heapsort(vector <int> & arr, int n)
{
	for(int i=n/2;i>=0;i--)
	{
		heapify(arr,i,n);
	}
	for(int i=n-1;i>=0;i--)
	{
		swap(arr[0],arr[i]);
		heapify(arr,0,i);
	}
}
main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	vector <int> arr(n);
	for(int i=0;i<n;i++)
		cin>>arr[i];
	heapsort(arr,n);
	cout<<arr[n/2];
}


/*
 * Created by Dipta Das on 06-05-2019
 * Title:
 * Problem Link:
 * Editorial:
 * Source Code:
 * Comments:
*/

#include <bits/stdc++.h>
#include <stdio.h>
#define fin freopen("input", "r", stdin)
#define whatis(x) cerr << #x << ": " << x << endl;

using namespace std;
using ll = long long;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int n;
    cin >> n;
    vector<ll> ar(n);
    for (int i = 0; i < n; ++i) {
        cin >> ar[i];
    }

    sort(ar.begin(), ar.end());

    int turn = 1;
    int start = 0, end = n-1, total = n;
    while (1) {
        if (turn == 0) {
            start++;
            --total;
            if (total == 1) {
                cout << ar[end] << endl;
                break;
            }
        } else {
            end--;
            --total;
            if (total == 1) {
                cout << ar[start] << end;
                break;
            }
        }
        turn = 1 - turn;
    }

    return 0;
}


#include <iostream>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

int main() {

	int n;
	cin >> n;
	vector<ll> ar(n);
	for (int i = 0; i < n; ++i) cin >> ar[i];
	sort(ar.begin(), ar.end());
	int turn = 1;
	int start = 0, end = n-1;
	while (start < end) {
		if (turn == 1) {
			turn = 2;
			start++;
		} else {
			turn = 1;
			end--;
		}
	}

	cerr << "start: " << start << " END: " << end << endl;
	cout << ar[start] << endl;

	return 0;
}


/*
 * Created by Dipta Das on 06-05-2019
 * Title:
 * Problem Link:
 * Editorial:
 * Source Code:
 * Comments:
*/

#include <bits/stdc++.h>
#include <stdio.h>
#define fin freopen("input", "r", stdin)
#define whatis(x) cerr << #x << ": " << x << endl;

using namespace std;
using ll = long long;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int n;
    cin >> n;
    vector<ll> ar(n);
    for (int i = 0; i < n; ++i) {
        cin >> ar[i];
    }

    sort(ar.begin(), ar.end());

    if (n % 2 == 1) {
        cout << ar[n/2] << endl;
    } else {
        cout << ar[n/2 - 1] << endl;
    }

    return 0;
}


#include <iostream>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

int main() {

	int n;
	cin >> n;
	vector<ll> ar(n);
	for (int i = 0; i < n; ++i) cin >> ar[i];
	sort(ar.begin(), ar.end());
	int turn = 2;
	int start = 0, end = n-1;
	int total = n;
	while (1) {
		if (turn == 1) {
			turn = 2;
			start++;
			total--;
			if (total == 1) {
				cout << ar[end] << endl;
				break;
			}

		} else {
			turn = 1;
			end--;
		    total--;
			if (total == 1) {
				cerr << ar[start] << endl;
				break;
			}

		}

	}

	for (int i = 0; i < n; ++i) cerr << i << "\t";
	cerr << endl;
	for (auto i : ar) cerr << i << "\t";
	cerr << endl;

	return 0;
}


/*
 * Created by Dipta Das on 06-05-2019
 * Title:
 * Problem Link:
 * Editorial:
 * Source Code:
 * Comments:
*/

#include <bits/stdc++.h>
#include <stdio.h>
#define fin freopen("input", "r", stdin)
#define whatis(x) cerr << #x << ": " << x << endl;

using namespace std;
using ll = long long;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int n;
    cin >> n;
    vector<ll> ar(n);
    for (int i = 0; i < n; ++i) {
        cin >> ar[i];
    }

    sort(ar.begin(), ar.end());

    if (n % 2 == 1) {
        cout << ar[n/2 + 1] << endl;
    } else {
        cout << ar[n/2 - 1] << endl;
    }

    return 0;
}


/*
 * Created by Dipta Das on 06-05-2019
 * Title:
 * Problem Link:
 * Editorial:
 * Source Code:
 * Comments:
*/

#include <bits/stdc++.h>
#include <stdio.h>
#define fin freopen("input", "r", stdin)
#define whatis(x) cerr << #x << ": " << x << endl;

using namespace std;
using ll = long long;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int n;
    cin >> n;
    vector<ll> ar(n);
    for (int i = 0; i < n; ++i) {
        cin >> ar[i];
    }

    sort(ar.begin(), ar.end());

    int turn = 1;
    int start = 0, end = n-1, total = n;
    while (1) {
        if (turn == 0) {
            start++;
            --total;
            if (total == 1) {
                cout << ar[end] << endl;
                break;
            }
        } else {
            end--;
            --total;
            if (total == 1) {
                cout << ar[start] << endl;
                break;
            }
        }
        turn = 1 - turn;
    }

    return 0;
}


#include<stdio.h>
int main ()
{
	int x,y,i,p,a[10000];
	scanf("%d",&p);
	for(i=1;i<=p;i++)
	scanf("%d",&a[i]);
	p=p-1;
	printf("%d\n",p);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int>vec;
    for(int i=1;i<=n;i++)
    {
        int tmp;
        cin>>tmp;
        vec.push_back(tmp);
    }
    for(int i=0;i<n-1;i++)
    {
        if(i%2==0)
        {
            vec.erase(max_element(vec.begin()+i,vec.end()));
        }
        else
            vec.erase(min_element(vec.begin()+i,vec.end()));
    }
    for(auto e:vec)
    cout<<e;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
        cin.tie(0);
    int n;
    cin>>n;
    vector<int>vec;
    for(int i=1;i<=n;i++)
    {
        int tmp;
        cin>>tmp;
        vec.push_back(tmp);
    }
    sort(vec.begin(),vec.end());
    if(vec.size()%2==0)
        cout<<vec[(vec.size()/2)-1];
    else
        cout<<vec[vec.size()/2];
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int>vec;
    for(int i=1;i<=n;i++)
    {
        int tmp;
        cin>>tmp;
        vec.push_back(tmp);
    }
    for(int i=0;i<n-1;i++)
    {
        if(i%2==0)
        {
            vec.erase(max_element(vec.begin()+i,vec.end()));
        }
        else
            vec.erase(min_element(vec.begin()+i,vec.end()));
    }
    for(auto e:vec)
    cout<<e;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int>vec;
    for(int i=1;i<=n;i++)
    {
        int tmp;
        cin>>tmp;
        vec.push_back(tmp);
    }
    sort(vec.begin(),vec.end());
    if(vec.size()%2==0)
        cout<<vec.size()/2;
        else
            cout<<(vec.size()+1)/2;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	int a[1005];
	cin >> n;
	a[0] = 0;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	sort(a + 1, a + 1 + n);
	if (n == 1)
	{
		cout << a[1] << endl;
	}
	else
	{
		cout << a[(n+1) / 2] << endl;
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	int a[1005];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	sort(a, a + n);
	if (n == 1)
	{
		cout << a[0] << endl;
	}
	else
	{
		cout << a[n / 2] << endl;
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	int a[1005];
	cin >> n;
	for (int i = 1; i < n; i++)
	{
		cin >> a[i];
	}
	sort(a, a + n);
	if (n == 1)
	{
		cout << a[0] << endl;
	}
	else
	{
		cout << a[(n+1) / 2] << endl;
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	int a[1005];
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	sort(a, a + n);
	if (n == 1)
	{
		cout << a[1] << endl;
	}
	else
	{
		cout << a[(n+1) / 2] << endl;
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	int a[1005];
	cin >> n;
	for (int i = 1; i < n; i++)
	{
		cin >> a[i];
	}
	sort(a, a + n);
	if (n == 1)
	{
		cout << a[n] << endl;
	}
	else
	{
		cout << a[(n+1) / 2] << endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x;

    cin>>n;
    cin>>x;
    for(int i=2;i<=n;i++)
    {
        int y;
        cin>>y;
    }
    cout<<x<<endl;
}


#include<bits/stdc++.h>
using namespace std;
vector<int>aa;
vector<int>a;
int main()
{
    int n,x;

    cin>>n;

    for(int i=1;i<=n;i++)
    {
        int s;
        cin>>s;
        a.push_back(s);
    }

int y=a.size();
    for(int i=0 ; i<y ; i+=2)
    {

        if(a.size()>=2){
        if(a[a.size()-1]>=a[a.size()-2] )
        {
            a.erase(a.begin()+a.size()-1);
        }
        else
        {
            a.erase(a.begin()+a.size()-2);
        }
        }
        if(a.size()>=2){
        if(a[a.size()-1]>=a[a.size()-2] )
        {
            a.erase(a.begin()+a.size()-2);
        }
        else
        {
            a.erase(a.begin()+a.size()-1);
        }
        }
    }

    cout<<a[0]<<endl;
}


#include<bits/stdc++.h>
using namespace std;
vector<int>aa;
vector<int>a;
int main()
{
    int n,x;

    cin>>n;

    for(int i=1;i<=n;i++)
    {
        int s;
        cin>>s;
        a.push_back(s);
    }

    for(int i=0 ; i<a.size() ;i+=2)
    {

        if(a.size()>=2){
        if(a[a.size()-1]>=a[a.size()-2] )
        {
            a.erase(a.begin()+a.size()-1);
        }
        else
        {
            a.erase(a.begin()+a.size()-2);
        }
        }
        if(a.size()>=2){
        if(a[a.size()-1]>=a[a.size()-2] )
        {
            a.erase(a.begin()+a.size()-2);
        }
        else
        {
            a.erase(a.begin()+a.size()-1);
        }
        }
    }

    cout<<a[0]<<endl;
}


#include<bits/stdc++.h>
using namespace std;
vector<int>aa;
vector<int>a;
int main()
{
    int n,x;

    cin>>n;

    for(int i=1;i<=n;i++)
    {
        int s;
        cin>>s;
        a.push_back(s);
    }

    sort(a.begin(),a.end());
    int y=3;
    while(a.size()>1)
    {
        if( y & 1)
        {
            a.erase(a.begin()+a.size()-1);
        }
        else

        {
            a.erase(a.begin()+0);
        }
        y++;
    }

    cout<<a[0]<<endl;
}


#include<bits/stdc++.h>
using namespace std;
vector<int>aa;
vector<int>a;
int main()
{
    int n,x;

    cin>>n;

    for(int i=1;i<=n;i++)
    {
        int s;
        cin>>s;
        aa.push_back(s);
    }
   int u=0;
    for(int i=n-1;i>=0;i--)
    {
        a.push_back(aa[i]);
    }
    for(int l=2;l<=n;){
            bool h=0;

    for(int i=0 ; i<a.size()-1 ;i++)
    {
        if(a[i]>=a[i+1])
        {
            //cout<<a[i]<<"K";
           a.erase(a.begin()+i);
           h=1;
           break;
        }
    }
    if(h==0 && a.size()>1)
    {
       // cout<<a[a.size()-1]<<"P";
        a.erase(a.begin()+a.size()-1);
    }
    l++;
    //cout<<" "<<l<<endl;
    if(l<=n)
    {
        bool hj=0;
     for(int i=0 ; i<a.size()-1 ;i++)
    {
        if(a[i]<a[i+1])
        {
           // cout<<a[i]<<endl;;
           a.erase(a.begin()+i);

           hj=1;
           break;
        }
    }
    if(hj==0 && a.size()>1)
    {
       // cout<<a[a.size()-1]<< " tt"<<endl;;
        a.erase(a.begin()+a.size()-1);
    }

     //a.erase(a.begin()+i);
    l++;
     //cout<<"    "<<l<<endl;
    }
    }

    cout<<a[0]<<endl;
}


#include <bits/stdc++.h>
using namespace std;
long long n,a[1005],b,c,d,i;
int main()
{
    cin>>n;
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    if(n%2==1)
        cout<<a[n/2];
        else cout<<a[n/2-1];
}


#include <bits/stdc++.h>
using namespace std;
long long n,a[1005],b,c,d,i;
int main()
{
    cin>>n;
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    if(n%2==1)
        cout<<a[n/2+1];
        else cout<<a[n/2-1];
}


#include <bits/stdc++.h>
using namespace std;
long long n,a[1005],b,c,d,i;
int main()
{
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    sort(a,a+n);
    if(n%2==1)
        cout<<a[n/2+1];
        else cout<<a[n/2];
}


#include <bits/stdc++.h>
using namespace std;
long long n,a[1000],b,c,d,i;
int main()
{
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    sort(a,a+n);
    if(n%2==1)
        cout<<a[n/2+1];
        else cout<<a[n/2];
}


#include <bits/stdc++.h>
using namespace std;
long long n,a[1005],b,c,d,i;
int main()
{
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    sort(a,a+n);
        cout<<a[n/2+1];
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &e:v)cin >> e;
    sort(v.begin(), v.end());

    cout << v[n + 1 / 2] << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &e:v)cin >> e;
    sort(v.begin(), v.end());
    cout << (n & 1 ? v[n / 2] : v[(n + 1) / 2]) << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    int a[n + 1];
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    cout << a[(n - 1) / 2 + 1] << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &e:v)cin >> e;
    sort(v.begin(), v.end());

    cout << v[n - 1 / 2] << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &e:v)cin >> e;
    sort(v.begin(), v.end());
    cout << v[n / 2] << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &e:v)cin >> e;
    sort(v.begin(), v.end());
    cout << (n & 1 ?  v[(n) / 2]: v[n / 2+1]) << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    int a[n + 1];
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    cout << a[(n / 2 + 1)] << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &e:v)cin >> e;
    sort(v.begin(), v.end());
    cout << (n & 1 ?  v[(n + 1) / 2]: v[n / 2]) << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector <int> mas(n);
    for (int i = 0; i < n; i++){
        cin >> mas[i];
    }
    sort(mas.begin(), mas.end());
    int f = 0, s = mas.size() - 1;
    while (s - f != 2){
        --s;
        if (s - f != 2){
            ++f;
        }
    }
    cout << mas[f + 1];
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector <int> mas(n);
    for (int i = 0; i < n; i++){
        cin >> mas[i];
    }
    sort(mas.begin(), mas.end());
    int res = n / 2 + n % 2;
    cout << mas[res - 1];
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector <int> mas(n);
    for (int i = 0; i < n; i++){
        cin >> mas[i];
    }
    sort(mas.begin(), mas.end());
    int e = 0;
    while (e != mas.size() - 1 && e++){
        if (e != mas.size() - 1)
            mas.pop_back();
    }
    cout << mas[e];
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector <int> mas(n);
    for (int i = 0; i < n; i++){
        cin >> mas[i];
    }
    sort(mas.begin(), mas.end());
    int f = 0, s = mas.size() - 1;
    while (s - f != 2){
        --s;
        if (s - f != 2){
            ++f;
        }
    }
    cout << mas[f];
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector <int> mas(n);
    for (int i = 0; i < n; i++){
        cin >> mas[i];
    }
    sort(mas.begin(), mas.end());
    int e = 0;
    if (e != mas.size() - 1){
        mas.pop_back();
    }
    while (e != mas.size() - 1){
        if (e != mas.size() - 1)
            mas.pop_back();
    }
    cout << mas[e];
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector <int> mas(n);
    for (int i = 0; i < n; i++){
        cin >> mas[i];
    }
    sort(mas.begin(), mas.end());
    int res = n / 2 + n % 2;
    cout << mas[res];
    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
const int MAXN = 1e3 + 20;

int a[MAXN], N;

int main()
{
	cin>>N;
	for(int i = 1; i <= N; i++)
		scanf("%d", &a[i]);
	sort(&a[1], &a[N]);

	if(N % 2 == 0) cout<<a[(N / 2)]<<endl;
	else cout<<a[(N + 1) / 2]<<endl;
	return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
const int MAXN = 1e3 + 20;

int a[MAXN], N;

int main()
{
	cin>>N;
	for(int i = 1; i <= N; i++)
		scanf("%d", &a[i]);
	sort(a + 1, a + N + 1);

	if(N % 2 == 0) cout<<a[(N / 2)]<<endl;
	else cout<<a[(N + 1) / 2]<<endl;
	return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
const int MAXN = 1e3 + 20;

int a[MAXN], N;//////

int main()
{
	cin>>N;
	for(int i = 1; i <= N; i++)
		scanf("%d", &a[i]);
	sort(&a[1], &a[N]);

	if(N % 2 == 0) cout<<a[(N / 2)]<<endl;
	else cout<<a[(N + 1) / 2]<<endl;
	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
// Policy based data structure
typedef tree<int, null_type,
			less_equal<int>, rb_tree_tag,
			tree_order_statistics_node_update>
	indexed_set;
#define ll long long int
#define pii pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define vi vector<ll>
#define vii vector<pii>
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define yes cout<<"YES"<<endl; return;
#define no cout<<"NO"<<endl; return;
#define flus fflush(stdin); fflush(stdout);
#define F first
#define S second
#define np next_permutation
#define inf 1e18
#define mod 1000000007
#define N 200009
#define pi (double)2*acos(0.0)
#define minpq priority_queue <ll, vector<ll>, greater<ll>>
#define maxpq priority_queue<ll>
void sout(){
	cout<<endl;
}
template <typename T,typename... Types>
void sout(T var1,Types... var2){
	cout<<var1<<" ";
	sout(var2...);
}
/*******************************************************************/

ll lbound(ll x,ll a[],ll n){
	ll ind=0;
	ll l=0,r=n;
	while(l<=r){
		ll mid=(l+r)/2;
		if(a[mid]>=x){
			ind=mid;
			r=mid-1;
		} else{
			l=mid+1;
		}
	}
	return ind;
}

void solve(){
	ll n;
	cin>>n;
	ll t[n+1];
	rep(i,1,n+1) cin>>t[i];
	t[0]=-inf;
	vi dp(n+1,0);
	rep(i,1,n+1){
		dp[i]=dp[i-1]+20;
		ll ind=lbound(t[i]-90+1,t,n);
		dp[i]=min(dp[i],dp[ind-1]+50);
		ind=lbound(t[i]-1440+1,t,n);
		dp[i]=min(dp[i],dp[ind-1]+120);
	}
	rep(i,1,n+1){
		cout<<dp[i]-dp[i-1]<<endl;
	}
	cout<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	// cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


/*
 ID: bradyawn
 PROG: contest
 LANG: C++11
 */

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <utility>
#include <algorithm>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <bitset>
#include <random>
#include <cstring>

using ll = long long;

using namespace std;

typedef long long ll;
typedef pair<int,int> i2;
typedef pair<ll,ll> ll2;

int n;

int main()
{
    //ifstream inf("");
    //ofstream outf("");
    //cout << setprecision(10);
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n;

    vector<int> arr(n+1);

    vector<int> dp(n+1);

    for (int i = 1; i <= n; i++) cin >> arr[i];

    for (int i = 1; i <= n; i++)
    {
        if (arr[i] == arr[i-1]) dp[i] = dp[i-1]; //no need to buy ticket
        else
        {
            int j = upper_bound(arr.begin(), arr.end(), arr[i]-90)-arr.begin();

            int k = upper_bound(arr.begin(), arr.end(), arr[i]-1440)-arr.begin();

            if (j) j--;
            if (k) k--;

            dp[i] = dp[i-1]+20;
            dp[i] = min(dp[i], dp[j]+50);
            dp[i] = min(dp[i], dp[k]+120);
        }

    }

    for (int i = 1; i <= n; i++) cout << dp[i]-dp[i-1] << '\n';

    return 0;

}


/*
 ID: bradyawn
 PROG: contest
 LANG: C++11
 */

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <utility>
#include <algorithm>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <bitset>
#include <random>
#include <cstring>

using ll = long long;

using namespace std;

typedef long long ll;
typedef pair<int,int> i2;
typedef pair<ll,ll> ll2;

int n;

int main()
{
    //ifstream inf("");
    //ofstream outf("");
    //cout << setprecision(10);
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n;

    vector<int> arr(n+1);

    vector<int> dp(n+1);

    for (int i = 1; i <= n; i++) cin >> arr[i];

    for (int i = 1; i <= n; i++)
    {
            int j = upper_bound(arr.begin(), arr.end(), arr[i]-90)-arr.begin();

            int k = upper_bound(arr.begin(), arr.end(), arr[i]-1440)-arr.begin();

            if (j) j--;
            if (k) k--;

            dp[i] = dp[i-1]+20;
            dp[i] = min(dp[i], dp[j]+50);
            dp[i] = min(dp[i], dp[k]+120);

    }

    for (int i = 1; i <= n; i++) cout << dp[i]-dp[i-1] << '\n';

    return 0;

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define M 1000000007
#define inf 1e15
#define all(a) (a).begin(),(a).end()

int main()
{
    boost
    int t,k,i,j,ii,jj;
    //ll M =1000000007;
    ll n,x,y,c,d,m,lo,hi,mid,a,b;
    string s;
    t=1;
    //cin>>t;
    int T=0;
    while(t--)
    {
        cin>>n;
        vector<ll>v(n);
        for(i=0;i<n;i++)
            cin>>v[i];
        ll dp[n]={0};
        dp[0]=20;
        int in;
        for(i=1;i<n;i++)
        {
            auto it = lower_bound(v.begin(), v.begin()+i,v[i]-89);
            x = *it;
            if(x != v[i])
            {
                in = it - v.begin();
                if(in==0)
                    x = 50;
                else
                    x = dp[in-1] + 50;
            }
            it = lower_bound(v.begin(), v.begin()+i,v[i]-1439);
            y = *it;
            if(y != v[i])
            {
                in = it - v.begin();
                if(in==0)
                    y = 120;
                else
                    y = dp[in-1] + 120;
            }
            dp[i] = min(dp[i-1]+20,min(x,y));
        }
        cout<<dp[0]<<"\n";
        for(i=1;i<n;i++)
            cout<<dp[i]-dp[i-1]<<"\n";
    }
}


#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vb vector< bool >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define sort(a) sort(a.begin(),a.end())
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define moddd (1000*1000*1000+9)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define endl "\n"
#define flush fflush(stdout)
#define pi 3.14159265358979323846264338327950
#define primeDEN 727999983

template <typename T>
void printvec(vector<T>& vec){
	for(int i=0;i<vec.size();i++){
		cout<<vec[i]<<" ";
	}
	cout<<endl;
}

int main(){
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int i;
	set<pii> sett;
	set<pii>::iterator it;
	int prev=0;
	for(i=0;i<n;i++){
		int ttime;
		cin>>ttime;
		int pre=prev+20;
		it=upper_bound(sett.begin(),sett.end(),mp(ttime-89,INT_MIN));
		if(it!=sett.end()){
			//cout<<"yes"<<" "<<it->ss<<" "<<pre<<endl;
			pre=min(pre,it->ss+50);
		}
		it=upper_bound(sett.begin(),sett.end(),mp(ttime-1439,INT_MIN));
		if(it!=sett.end()){
			pre=min(pre,it->ss+120);
		}
		sett.insert(mp(ttime,prev));
		cout<<pre-prev<<endl;
		prev=pre;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vb vector< bool >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define sort(a) sort(a.begin(),a.end())
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define moddd (1000*1000*1000+9)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define endl "\n"
#define flush fflush(stdout)
#define pi 3.14159265358979323846264338327950
#define primeDEN 727999983

template <typename T>
void printvec(vector<T>& vec){
	for(int i=0;i<vec.size();i++){
		cout<<vec[i]<<" ";
	}
	cout<<endl;
}

int main(){
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int i;
	set<pii> sett;
	set<pii>::iterator it;
	int prev=0;
	for(i=0;i<n;i++){
		int ttime;
		cin>>ttime;
		int pre=prev+20;
		it=upper_bound(sett.begin(),sett.end(),mp(ttime-89,INT_MIN));
		if(it!=sett.end()){
			//cout<<"yes"<<" "<<it->ss<<" "<<pre<<endl;
			pre=min(pre,it->ss+50);
		}
		//
		it=upper_bound(sett.begin(),sett.end(),mp(ttime-1439,INT_MIN));
		if(it!=sett.end()){
			pre=min(pre,it->ss+120);
		}
		sett.insert(mp(ttime,prev));
		cout<<pre-prev<<endl;
		prev=pre;
	}
	return 0;
}