#include"math.h" i=50;j;a;char c[9];main(){while(i--){a=0;scanf("%s",&c);for(j=-1;++j<8;)a+=a+c[j]-48;printf("%d",!fmodf(sqrt(a*8+1)+1,2));}}