{$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;
Procedure Load;
Begin
  N:=GetN;
End;
Procedure Run;
Var
  Seq:Array[1..MaxN]Of LongInt;
  I,J:LongInt;
  First,Second,Middle:LongInt;
  Left,Right:LongInt;
Begin
  Seq[1]:=1;
  Seq[2]:=2;
  For I:=3 To N Do Begin
    Left:=1;
    Right:=I-1;
    If Left<I-(N+1) Div 2 Then
      Left:=I-(N+1) Div 2;
    If Right>(N+1) Div 2 Then
      Right:=(N+1) Div 2;
    While Left<Right Do Begin
      First:=Left-1+(Right-Left+2) Div 3;
      Second:=First+(Right-First+1) Div 2;
      Middle:=Med3(Seq[First],Seq[Second],I);
      If Middle=Seq[First] Then Begin
        Right:=First-1;
      End Else If Middle=Seq[Second] Then Begin
        Left:=Second+1;
      End Else If Middle=I Then Begin
        Left:=First+1;
        Right:=Second-1;
      End;
    End;
    If Left=Right Then Begin
      If (Left<I-1) Then Begin
        Middle:=Med3(Seq[Left],Seq[Left+1],I);
        If Middle<>Seq[Left] Then Inc(Left);
      End Else Begin
        Middle:=Med3(Seq[Left],Seq[Left-1],I);
        If Middle=Seq[Left] Then Inc(Left);
      End;
    End;
    For J:=N DownTo Left Do Seq[J+1]:=Seq[J];
    Seq[Left]:=I;
  End;
  Result:=Seq[(N+1) Div 2];
End;
Procedure Save;
Begin
  Answer(Result);
End;
Begin
  Load;
  Run;
  Save;
End.
