for(;c=readline();)print(+!(Math.sqrt(8*parseInt(String(c),2)+1)%1))