Program Zif_4_12_Z(input,output);
Var k,x:integer;
BEgin
     read(k);
     if odd(k) then x:=((k div 2)+10)div 10
     else x:=((k div 2 - 1)+10)mod 10;
     writeln(x);
End.