c=new java.util.Scanner(java.lang.System.in);for(;c.hasNext();){l=c.nextLine();print(+!((Math.sqrt(8*parseInt(l,2)+1)-1)%2));}