#include<stdio.h>
int main()
{ int i,n=0,x=0;
char c;
freopen("onezero.txt","r",stdin);
freopen("firans.txt","w",stdout);
for(i=0; i<8; i++)
{ scanf("%c",&c);
if(c=='1')n++;
x=x*2+c-'0';
}
printf("%d\n%d\n",n,x);
fclose(stdin);
fclose(stdout);
return 0;
}