#include #include int main() { char s[8]; for(int i=0;i<50;i++) { scanf("%s", s); int x=0; for(int j=0; j<8;j++) { x *= 2; x += (s[j]=='1'); } int y = 1 + 8 * x; int z =(int)sqrt((double)y); printf("%d", z * z / y); } return 0; }