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