program nuliu_ir_vienetu_seka;
  { 12 u‘davinys }
{----------------------------------------------------------}
  function narys (n : integer) : integer;
    var vien : integer;
  begin
    vien := 0;
    n := n - 1;
    while n > 0 do
      begin
        vien := vien + n mod 2;
        n := n div 2;
      end;
    if odd (vien)
       then narys := 1
       else narys := 0
  end;
{----------------------------------------------------------}
  var n : integer;
begin
  write ('­veskite n: ');
  readln (n);
  writeln (narys (n))
end.