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