{$A+,B-,D+,E-,F-,G-,I+,L+,N+,O-,P-,Q-,R+,S+,T-,V+,X+}
{$M 65520,0,655360}
Program Median;
Uses Device;
Const
  MaxN=1501;
Var
  N:LongInt;
  Result:LongInt;
  Work:Array[1..MaxN]Of Byte;
Procedure Load;
Begin
  N:=GetN;
End;
Procedure Run;
Var
  Seq:Array[1..MaxN]Of LongInt;
  I,J:LongInt;
Function Compare(A,B:LongInt):Boolean;
Var
  Rev,Res:Boolean;
  T,Middle:LongInt;
Begin
  If A>B Then Begin
    T:=A;
    A:=B;
    B:=T;
    Rev:=True;
  End Else Rev:=False;
  If (A=1) Then Begin
    If (B=N) Then Begin
      Res:=False;
    End Else Begin
      Middle:=Med3(1,B,N);
      If Middle=1 Then Res:=True Else Res:=False;
    End;
  End Else If (B=N) Then Begin
    Middle:=Med3(1,A,N);
    If Middle=N Then Res:=True Else Res:=False;
  End Else Begin
    Middle:=Med3(1,A,B);
    If Middle=1 Then Begin
      Middle:=Med3(1,N,A);
      If Middle=1 Then
        Res:=False
      Else If Middle=N Then
        Res:=True
      Else {Middle=A}
        Res:=True;
    End Else If Middle=A Then Begin
      Middle:=Med3(1,N,A);
      If Middle=1 Then
        Res:=True
      Else If Middle=N Then
        Res:=False
      Else {Middle=A}
        Res:=False;
    End Else {Middle=B} Begin
      Middle:=Med3(1,N,A);
      If Middle=1 Then
        Res:=False
      Else If Middle=N Then
        Res:=True
      Else {Middle=A}
        Res:=True;
    End;
  End;
  If Rev Then Res:=Not Res;
  Compare:=Res;
  If Res Then If Rev Then Work[B]:=2 Else Work[A]:=2 Else If Rev Then Work[B]:=1 Else Work[A]:=1;
End;
procedure Sort(l, r: Integer);
var
  i, j, x, y: longint;
begin
  i := l; j := r; x := seq[(l+r) DIV 2];
  FillChar(Work,SizeOf(Work),0);
  repeat
    while (seq[i]<>x) and (((work[seq[i]]=0) and not compare(seq[i],x)) or (work[seq[i]]=1)) do
      i := i + 1;
    while (seq[j]<>x) and (((work[seq[j]]=0) and compare(seq[j],x)) or (work[seq[j]]=2)) do
      j := j - 1;
    if i <= j then
    begin
      y := seq[i]; seq[i] := seq[j]; seq[j] := y;
      i := i + 1; j := j - 1;
    end;
  until i > j;
  if j>=(N+1) Div 2 then Begin
    If (l<j) then
      Sort(l, j)
    else
      Result:=Seq[l];
  End Else if (i<=(N+1) div 2) Then Begin
    if (i<r) Then
      Sort(i, r)
    Else
      Result:=Seq[r];
  End Else Result:=Seq[j+1];
end;
Begin
  For I:=1 To N Do Seq[I]:=I;
  Sort(1,N);
End;
Procedure Save;
Begin
  Answer(Result);
End;
Begin
  RandSeed:=1238216432;
  Load;
  Run;
  Save;
End.
