while a=gets;p sqrt(1+8*a.to_i 2)%1>0?0:1;end