for(;;)print(+!(Math.sqrt(8*parseInt(require('system').system.stdin.read(9),2)+1)%1))