importPackage(java.io);importPackage(java.lang);s=new BufferedReader(new InputStreamReader(System.in));while(l=s.readLine()){print(+![0,1,3,6,10,15,21,28,36,45,55,66,78,91,105,120,136,153,171,190,210,231,253].every(function(i){return i-parseInt(l,2)}))}