#include <stdio.h>

void merge(int, int, int, int);
void mergeSort(int, int, int);
int main()
{
  int left, mid, right;
  int n, S[500000];
  int i;
  
  scanf("%d", &n);
  for(i = 0; i < n; i++)
    scanf("%d", &S[i]);

  printf("\nn = %d\n", n);
  for(i = 0; i < n; i++)
    printf("S[%d] = %d\n", i, S[i]);
  printf("\n");

  left = S[0];
  right = S[n];
  if(n%2 == 0) mid = S[n/2+1];
  if(n%2 == 1) mid = S[(n+1)/2];
  
  return 0;
}

void merge(int S, int left, int mid, int right)
{
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  int L[250000], R[250000];
  // L[0...n1], R[0...n2] ?????????
  for(i = 0; i < n1; i++)
    L[i] = S[i];
  for(i = mid ; i < n2; i++)
    R[i] = S[i];
  for(i = 0; i < n1-1; i++)
    {
      L[i] = S[left+i];
      for(i = 0; i < n2-1; i++)
	{
	  R[i] = S[mid+i];
	  L[n1] = INFTY;
	  R[n2] = INFTY;
	  i = 0;
	  j = 0;
	  for(k = left; k < right-1; k++)
	    {
	      if(L[i] <= R[j])
		{
		  S[k] = L[i];
		  i = i + 1;
		  else
		    {
		      S[k] = R[j];
		      j = j + 1;
		    }
		}
	    }
	}
    }
}
void mergeSort(int S, int left, int right)
{
  int mid;
  if (left+1 < right)
    mid = (left + right)/2;
  mergeSort(S, left, mid);
  mergeSort(S, mid, right);
  merge(S, left, mid, right);
}