f={case 0->0 case x->f(int(x/10))*2+x%2} stdin|{x->if(sqrt(f(number(x))*8+1)%1>0)0else 1}|puts