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