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