importPackage(java.io);importPackage(java.lang);s=new BufferedReader(new InputStreamReader(System.in));while(l=s.readLine()){print(+!((Math.sqrt(8*parseInt(l,2)+1)-1)%2)}