import std.stdio; import std.conv; void main(){string s;while ((s=readln()).length>3){int i=to!int(split(s)[0],2);writeln((8*i+1)**.5%2==1);}}